I use ajax with jquery and when I tried to display the result in popup. Then alert always displays 0
0
success : function(results) { alert(result
In your PHP function, make sure you're using echo instead of return.
echo
return
This was happening for me in a WordPress theme.
function doAjax() { $result = getPosts(); echo json_encode($result, true); die(); }