0
我得到一個Desc :: parsererror |錯誤:: SyntaxError:以下代碼的意外的令牌U錯誤。 PHP頁面是呼應json_encode
產生JSON,還含有JSON解析錯誤。意外的令牌U
header("Content-type: application/json");
這裏是AJAX代碼。
$.ajax({
url: 'questions/checkAnswer',
type: 'POST',
data: {questionId : questionIdValue, answer : answerValue},
dataType: 'json',
success:function(result){
console.log(result);
},
error:function(xhr, desc, err) {
console.log(xhr);
console.log("Desc :: "+desc+"\nError :: "+err);
}
});
任何人都可以幫我關於我哪裏錯了?
向我們展示瀏覽器接收到的JSON響應。 –
我不知道我能否幫到你。如果你要求的是JSobject,那麼這裏是{「question_id」:「0」,「question_name」:「誰贏了最後一個板球杯?」,「choice_a」:「印度」,「choice_b」:「澳大利亞」 ,「choice_c」:「南非」,「choice_d」:「新西蘭」} – psyc0der
......什麼是「JSObject」?你的意思是[「JSON文本?」](https://tools.ietf.org/html/rfc4627#section-2) –