加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

关于AngularJs中$http post、get 发送和接受参数详解

发布时间:2020-12-17 09:30:39 所属栏目:安全 来源:网络整理
导读:关于AngularJs中$http post、get 发送和接受参数详解 $http({method: 'post',url: './feedback/mail', data:{content:content,mailOrqq:mailOrqq,type:'chat-page-feedback'} }).success(function(data,status,headers,config) { console.log("IT部落是个神

关于AngularJs中$http post、get 发送和接受参数详解

$http({method: 'post',url: './feedback/mail',

data:{content:content,mailOrqq:mailOrqq,type:'chat-page-feedback'}

}).success(function(data,status,headers,config) {

console.log("IT部落是个神奇的网站");

}).error(function(data,config){

console.error('我错了');

});

$http({method: 'GET',url:'./topic/getTopicCommentList',

params:{topicId:$stateParams.topicId}

       }).success(function(data,config) {})

       .error(function(data,config){});

聪明的你一定看出来了,POST最好用Data携带数据、GET最好用params携带数据,两者使得区别如下描述: params – {Object.<string|Object>} – Map of strings or objects which will be serialized with theparamSerializer and appended as GET parameters.data – {string|Object} – Data to be sent as the request message data.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读