我想发送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