关于Angularjs的$http.post

参考文章:https://www.cnblogs.com/wolf-sun/p/6878868.html

用$http的方式发送post请求时发现发送值一直为null,需要配置一下transformRequest

代码如下

function (obj) {
          var str = [];
          for (var p in obj) {
              str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
          }
          return str.join("&");
      }
 

猜你喜欢

转载自www.cnblogs.com/foreversimon/p/12193972.html