问题:jquery里的ajax在提交post请求时,如果数据里有一个空数组,则这个空数组不会提交上去

技术上的解决办法如下:

jquery的$post方法不发送空数组的解决办法

源代码:

var params = {
    type : 1,
    ids:[]
};
$.ajax({
   type: "POST",
   url: "test.php",
   contentType:"application/json;charset=utf-8",
   data:JSON.stringify(params),
   dataType: "json",
   success:function(data){
    
   }
   
});

 

相关文章:

  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2021-04-07
  • 2022-01-22
  • 2022-12-23
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-08-17
相关资源
相似解决方案