由於某種原因,下面的ajax代碼存在解析錯誤。我怎麼能找出它是什麼,和/或有人可以看到什麼是錯的?請求的JSON解析失敗
$('#listElements').sortable({
//revert: true,
update: function(event, ui) {
var order = [];
$('.listObject li').each(function (e) {
order.push($(this).attr('id'));
});
$.ajax({
type: "POST",
url: "index.php?",
dataType: "json",
data: { json: order }, error: function(jqXHR, exception) {
if (jqXHR.status === 0) {
alert('Not connect.\n Verify Network.');
} else if (jqXHR.status == 404) {
alert('Requested page not found. [404]');
} else if (jqXHR.status == 500) {
alert('Internal Server Error [500].');
} else if (exception === 'parsererror') {
alert('Requested JSON parse failed.');
} else if (exception === 'timeout') {
alert('Time out error.');
} else if (exception === 'abort') {
alert('Ajax request aborted.');
} else {
alert('Uncaught Error.\n' + jqXHR.responseText);
}
}
});
}
怎樣的錯誤說? –
解析錯誤在這個JS代碼,或在服務器上的結果JSON文本? –
你有沒有嘗試刪除前導index.php? –