请求的JSON解析失败

由于某种原因,下面的ajax代码存在解析错误。 我怎么能找出它是什么,和/或有人能看出什么是错的?

$('#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); } } }); } 

数据:{json:order} …格式不正确……

此JavaScript代码中没有解析错误。

请发布“index.php”的回复和您收到的错误消息。

看看响应数据。 在浏览器中打开index.php,按F12并将其插入控制台:

  $.ajax({ type: "POST", url: "index.php", //dataType: "json", data: { json: order }, success: function(data) { console.log(data); } });