[SOLVED] getJSON won't execute callback function
When I use this script with the $.get method it works exactly as expected, but as soon as I change it to $.getJSON the callback fails.
I'm using it to send a query to a PHP page. Callback failures seem to indicate a problem with the JSON structure, but I've used json_encode() in the PHP script to create it, and I've also tried writing simple JSON objects for testing. I've removed all spaces from the JSON, fooled with the quotes around the name/value pairs. Nothing works. The callback never gets called.
Here's my jQuery script:
$(function() {
$('.foo').click(function() {
var formData = 'page=pagetwo';
$.getJSON('server.php', formData, listIt);
});
function listIt(data) {
$('#response').html(data);
};
});
Here's the end of the PHP script:
$theReturn = json_encode($row_getInfo);
echo $theReturn;
This seems so simple, but I'm really stumped. Any suggestions would be much appreciated.
Thanks,
John