Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
AJAX request not returns response in hosting server.

I have tested it in localhost it works normally but when I am testing it in hosting server it returns blank response.

I have checked values in variable using var_dump. It is having value but when I echo it using json_encode method it returns blank response.
Posted
Comments
Sradhanjali Behera 25-Nov-15 6:42am    
Please alert your data.what is coming.
jagdish123061 25-Nov-15 6:44am    
response is blank.

json_encode not working
Sradhanjali Behera 25-Nov-15 6:47am    
$result['Comments'] = $comm;
echo json_encode($result);
exit;
Sradhanjali Behera 25-Nov-15 6:48am    
echo it and console it.
jagdish123061 25-Nov-15 6:57am    
solved it. problem in values some values are not in collation utf-8. So i had convert it using function:

function utf8ize($d) {
if (is_array($d)) {
foreach ($d as $k => $v) {
$d[$k] = utf8ize($v);
}
} else if (is_string ($d)) {
return utf8_encode($d);
}
return $d;
}


and then echo json_encode(utf8ize($result))

1 solution

VB.NET
solved it. problem in values some values are not in collation utf-8. So i had convert it using function:

<pre lang="PHP">
function utf8ize($d) {
  if (is_array($d)) {
    foreach ($d as $k => $v) {
       $d[$k] = utf8ize($v);
    }
  }
  else if (is_string ($d)) {
        return utf8_encode($d);
  }
 return $d;
}



and then echo json_encode(utf8ize($result))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900