我想發送json數據到php文件。當我把它作爲查詢字符串它,一半的數據被髮送,當我以下列方式則沒有在所有json數據通過ajax請求未被髮送
Ext.Ajax.request({
url: 'GetData.php',
params: {
data:document.getElementById("jsonData").value
},
method: "POST",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(xhr) {
console.log(xhr)
}
});
送送它,我已經以不同的方式修改了我的Ajax調用但它總是發送空。我已經檢查過我的hiddenfield'jsonData'有數據在發出ajax請求之前。請幫助 這裏JSON數據 -
{"items":[{"text":"Table of Contents","items":[{"text":"Cover","source":"book/00__Cover.html","leaf":true,"items":"[]"},
{"text":"Introduction","source":"book/Introduction.html","leaf":true,"items":"[{\"text\":\"Me maps\",\"source\":\"book/Introduction.html#c000030\\\"\",\"leaf\":true},{\"text\":\"Spatial perspective\",\"source\":\"book/Introduction.html#c000031\\\"\",\"leaf\":true}]"},{"text":"Index","source":"book/Index.html","leaf":true,"items":"[]"}]},{"text":"My Study Guide","source":"studyguide.js","leaf":true},{"text":"Shared","source":"shared.js","leaf":true}]}
你能告訴我們'jsonData'嗎? –
您是否嘗試過console.log(document.getElementById('jsonData')。的值只是Ext.Ajax.request之前的一行,這將幫助您查看數據是否被反過來檢查您的json數據是否正確格式 –
我檢查了它在隱藏字段中的數據 - – Annie