In my application im getting the data from database using ajax call as json array data. But some times i may not get the data from database based on condition. How can i check whether there is any data in the ajax returned array.
Here is my code..
Ajax Call:
$.ajax({
type:'POST',
url:'user_panel/index',
data: 'ov_prem_home_id='+home_id,
dataType: 'json',
cache: false,
success: function(dataResponse){
document.getElementById('ov_prem_title').value=data[0]['title'];
}
});
PHP Code
$home_id=$_POST[home_id];
$ov_result=getPremOveriewData($home_id);
echo json_encode($ov_result);exit;
I tried the conditions like isset(dataResponse),if(dataResponse=='')
but i didn't got anything