2012-08-07 77 views
0

我有一個頁面調用一個PHP腳本。在MAMP一切工作正常,但是當我把它上傳到服務器,我收到以下錯誤:PHP MAMP和服務器衝突

Call Request failed! Status code: 4000 
Reason - Caught an HttpRequestValidationException due to some bad characters in the request. Make sure your post request is encoded as xml, preferable as UTF-8 ('Content-Type: text/xml; charset=utf-8'). Exception: A potentially dangerous Request.Form value was detected from the client (<?xml version="..."utf-8"?> <uclassify xmlns="ht..."). 

有沒有人見過這樣的事情?

你可以檢查一下自己here只是放置一個像PHP或iOS

回答

1

它看起來像你的服務器是基於content-type頭驗證的。它似乎想要text/xml,而您發送的是application/x-www-form-urlencoded(這是$.ajax的默認值)。

嘗試在$.ajax調用中明確設置內容類型爲text/xml。 (reference

+0

你是什麼意思這樣的$ .ajax({0}類型:「POST」, 內容類型:「內容類型:文本/ xml;字符集= UTF-8」, url:「questions.php」, data:{'amount':amount}, – 2012-08-07 17:51:13

+0

類似於:$ .ajax({type:「POST」,content-type:「text/xml; charset = UTF-8」,/ * etc等* /' – 2012-08-07 17:56:06

+0

說的是語法錯誤! – 2012-08-07 18:11:29

1

嘗試改變charset=utf-8charset=UTF-8

+0

nooo我得到了一些錯誤! – 2012-08-07 17:41:14