如何同時發送GET和POST參數與jquery ajax請求?jquery同時發送GET和POST參數在ajax請求
我試圖將do=ajax&id=" + ID
添加到url
,但因爲結果請求只打磨到sss.php
而沒有查詢字符串(get part)。謝謝。
$.ajax({
url: "sss.php?do=ajax&id=" + ID ,
type: "post",
data: "ddd=sss",
// callback handler that will be called on success
success: function(response, textStatus, jqXHR){
// log a message to the console
console.log("Hooray, it worked!");
},
// callback handler that will be called on error
error: function(jqXHR, textStatus, errorThrown){
// log the error to the console
console.log(
"The following error occured: "+
textStatus, errorThrown
);
}
});
嘗試使用'$ .post'而不是'$ .ajax' – defuz
@defuz:他/她*使用'post',用於所有意圖和目的。 ['post'](http://api.jquery.com/jQuery.post/)僅僅是'type:「post」'請求的便捷包裝。 –
對我而言,您的解決方案正在發揮作用。它也應該適合你。開始並檢查您的Chrome網絡控制檯,以查看發送給服務器的請求。 –