[jQuery] not returning a JSON object
Hi,
i have a form defined as follows:
$(document).ready(function(){
$('#edit_page_form').ajaxForm({
type: "POST",
timeout: 45000,
dataType: 'json',
error: function() {
alert("error etc ");
},
success: function(json) {
alert(json);
alert(json.message);
},
complete: function() {
alert('done');
}
});
});
when alerting json in the success function - it echoes out the Json as
a string, and not a valid object - hence, json.message doesnt work/is
undefined.
from the server side:
echo '{ message: "why wont this work" }';
im using jquery 1.7.2.
is there something obvious i am missing?
cheers
Joe