我有以下的JSON回來:無法附加內容回來的JSON
{"gameId":137.0,"memberId":3,"id":97.0,"reviewBody":"Great game! Awesome.","createdAt":"October, 13 2010 18:55:34"}
我試圖將其追加使用下面的JavaScript層,但沒有什麼是顯示:
$(function(){
$(".review-form").submit(function(){
dataString = $(".review-form").serialize();
$.ajax({
type: "POST",
url: "#URLFor(controller="membros", action="createReview")#",
data: dataString,
dataType: "JSON",
returnFormat: "JSON",
success: function(response) {
$(".review-confirmation").html(response.REVIEWBODY);
$('.review-form').slideToggle('slow', function() { });
}
});
return false; // keeps the normal request from firing
});
});
我已經嘗試使用大寫,小寫和駱駝案件response.reviewBody,但沒有任何顯示。任何想法,我要去錯了嗎?
基本調試。 alert(response.reviewBody);'說什麼? – 2010-10-13 22:08:05
它說「未定義!」 :/ – Mohamad 2010-10-13 22:10:38
但「響應」顯示整個JSON字符串... – Mohamad 2010-10-13 22:11:22