I've started the following skeleton for an ajax/post/update function I'm wanting to write in javascript (using jquery):
$.post("/gallery/resize",
function (data) {
alert(data);
alert(data.complete);
if (data.complete) {
alert("done");
} else {
alert("blah");
}
},
"json"
);
And the response script on the server is:
$return['complete'] = 'complete';
header('Content-type: application/json');
echo json_encode($return);
exit;
The FireBug console shows that I get a JSON string in response - but the value of data.complete is 'undefined'. Here is the string from the server as reported by the FireBug (I also have a corresponding value/data pair under the JSON tab under the XHR display in the console):
{"complete":"complete"}
Any pointers on what I might've missed...
I am working on a localhost server - apache on ubuntu - if that makes a difference?