jQuery Ajaz to check if returned data object is empty
In one of my jQuery Ajax Request ,I need to check wehter quary return empty results. $ . post ( "php/socialbookmark-post.php" , { bookmarkID : $ ( this ). val ()}, function ( data ) { if ( data != "" ) alert ( data ); }); data !== 'undefined' && data !== '' not worked Properly and Stack OverFlow also not given good answer. I observed, If empty data set returned , the full block will not executed. http://stackoverflow.com/questions/2589558/jquery-to-check-if-returned-data-object-is-empty But refffering to jQuery I able to come up with solid answer. http://api.jquery.com/jQuery.ajax/ By defult we inherit the sucess method (done ) and if empty data set returned it will go (fail). $.post("./testURL" function (o) { ...