一、post请求可以传body和query两种形式的参数:

【body传参】:
$.ajax({
   type : "POST",
   url : "xxxxxxxxxxxxxx",
   data : {
    ids: tempID
    }
   ...
  })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
【body传参,当要求传JSON字符串格式的参数时】:
$.ajax({
   type : "POST",
   url : "xxxxxxxxxxxxxxxx",
   dataType : "json",
   data : JSON.stringify({ids: tempID}),
   contentType:"application/json;charset=utf-8",
    ...
  })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.

二、当query传参时:

$.ajax({
   type : "POST",
   url : "xxxxxxxxxxxxxx",
   params: params // params就是query参数,params的值只能是一个字符串多个参数要使用&连接,不能传递对象类型的参数,如果参数中涉及到了传递对象,就要选择body传参
/                 //比如:?oginType=a&target1=b&target2=c&validateCode=d&userType=e&rememberMe=f
   ...            
  })
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.