I have json_encoded an array of a mysql result as shown here:
$allquery="SELECT * FROM wp_users";
$names = array();
$allresult=mysql_query($allquery) or die(mysql_error()); ?>
<?php while($rows=mysql_fetch_array($allresult)){
$names[] = $rows['display_name'];
}
print json_encode( array(
"res" => $names,
"fvdfvv" => "sdfsd"
)
);
My problem is… when it gets back to the client-side, I am unsure about how to display it. I try and alert the reply on success:
success: function(result){
var allresult = result.res
$('#result').html( allresult );
alert(allresult);
//$("#notice_div").hide();
}
But this doesnt return anything. In fact, the success handler doesnt even begin.
Any ideas?
Thanks
I would check your making a JSON request with your request call, I know mootools can be funny about that not sure what framework your using is it jQuery?
I would use echo instead of print (buts thats my preference)
Do you get any results at all? have you alerted out “result”?
if your definitely sure the success handler isn’t firing, the problem is elsewhere. Perhaps you can expand your post with more of your code.