












一、post请求可以传body和query两种形式的参数:
【body传参】: $.ajax({ type : "POST", url : "xxxxxxxxxxxxxx", data : { ids: tempID } ... })
【body传参,当要求传JSON字符串格式的参数时】: $.ajax({ type : "POST", url : "xxxxxxxxxxxxxxxx", dataType : "json", data : JSON.stringify({ids: tempID}), contentType:"application/json;charset=utf-8", ... })
二、当query传参时:
$.ajax({ type : "POST", url : "xxxxxxxxxxxxxx", params: params // params就是query参数,params的值只能是一个字符串多个参数要使用&连接,不能传递对象类型的参数,如果参数中涉及到了传递对象,就要选择body传参
/ //比如:?oginType=a&target1=b&target2=c&validateCode=d&userType=e&rememberMe=f ... })
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。