$http.get请求数据的格式
- $http.get(URL,{
- params:{
- "id":id
- }
- })
- .success(function(response,status,headers,config){
-
- })
$http.post请求数据的格式
$http.post(URL,248); line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> "id":id
- tips:
get 和 post方法传递参数的方式不一样。
- .factory("shareGoodsListService",["$http",function($http){
- return{
-
- updateAddress:function(__scope__,addrid){
-
- //获取地址的值
- varProvince=$("select[name='Province']").val();
- varCity=$("select[name='City']").val();
- varArea=$("select[name='Area']").val();
- varformData={
- id:addrid,
- name:__scope__.formData.name,
- mobile:__scope__.formData.mobile,248); line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> province:Province,108); list-style:decimal-leading-zero outside; color:inherit; line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> city:City,248); line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> area:Area,108); list-style:decimal-leading-zero outside; color:inherit; line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> address:__scope__.formData.address,248); line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> zip:__scope__.formData.zip,108); list-style:decimal-leading-zero outside; color:inherit; line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> submit:"submit"
- };
- $http.post("{:U('AddressInfo/editAddress')}",formData).success(function(response,153); background-color:inherit; font-weight:bold">if(response.status==1){
- alert("修改成功!");
- }
- })
- },248); line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> getAddress:function(){
- //$http.get方法传递参数使用的是{params:jsonObj}
- $http.get("{:U('AddressInfo/editAddress')}",{
- params:{
- .success(function(response,config){
- //获取地址的数据
- __scope__.formData={
- name:response.data.name,248); line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> mobile:response.data.mobile,108); list-style:decimal-leading-zero outside; color:inherit; line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> address:response.data.address,248); line-height:18px; margin:0px!important; padding:0px 3px 0px 10px!important"> zip:response.data.zip
- };
- //默认收货地址的值
- newPCAS("Province","City","Area",response.data.province,response.data.city,response.data.area);
- }])
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|