0
下面是導致有問題的ajax調用的函數。下面是在被插入的參數,如JavaScript調試器在Firefox中給出:Jquery Ajax請求有誤 - 某些內容丟失或不正確
JSON.stringify(c) = {"start":0,"length":20,"sortBy":"dc","sortAscending":false,"providerId":128391,"currencyIds":[],"fromDateStr":"2007-01-01","toDateStr":"2014-01-10","validTrades":true,"lotSize":2}
b.resolveUrl(e) = "http://localhost/j1/test/proxy.php"
g = [object Window]
b = [object Object]
a.isFunction(d) && d.call(g, c, f, g) = false
的功能:
a.ajax(a.extend({
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(c),
url: b.resolveUrl(e),
context: g,
cache: !1,
success: function (c, e, d) {
a.isFunction(f) &&
f.call(g, "undefined" != typeof c.d ? b.parseJSON(c.d) : c, g, e, d)
},
error: function (b, c, f) {
a.isFunction(d) && d.call(g, c, f, g)
}
}, h))
這是爲什麼會出錯?怎麼了?我已經插入到proxy.php文件的開頭以下,以確保數據正確發佈:「POST失敗」
在我看到請求的響應信息。
嘗試簡化你的ajax請求,看看你是否可以得到它的工作。 '.ajax({type:'POST',data:'testing',url:'/ j1/test/proxy.php'})'。然後開始添加其餘的ajax選項,直到它再次中斷爲止 –
我不認爲數據需要字符串化對象。嘗試一個普通的json對象或查詢字符串('val = bla&foo = bar')。但是,如果請求按原樣工作,那麼PHP將無法將其解析到'$ _POST'數組中,嘗試獲取原始後值('http_get_request_body()')。 – towr