Hi,
I have this bit of php returning the response, just for testing :
header('Content-type: application/json');
$response = array();
$response["status"] = "ok";
echo json_encode( $response );
1) Is this a wrong way to send a json encoded string back via jquery ajax?
2) I get NOTHING, No response from this ajax call made by jquery - Even no errors alerted..
$.ajax({
url: 'controllers/update_page_positions.php',
data: {id: id, placering: placering},
type: 'GET',
dataType: 'json',
succes: function( data ) {
if( data.status == "ok" ) {
alert('ajax ok..');
}
else {
alert('ajax fejl..');
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
alert( xhr.responseText);
}
});
What am I doing wrong here?
**EDIT: See attached img from Firebug - I get status 200 returned in the console, and I can see the response as the image shows...
So am I handling the response in a wrong way - Or is it the php string I am formatting incorrect?**
Best, Klemme