如何同时发送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网络控制台,以查看发送给服务器的请求。 –