$http.get请求数据的格式

  1. $http.get(URL,{
  2. params: {
  3. "id":id
  4. }
  5. })
  6. .success(function(response, status, headers, config){
  7. })

$http.post请求数据的格式

  1. $http.post(URL,{
  2. "id":id
  3. })
  4. .success(function(response, status, headers, config){
  5. })

tips:

get 和 post方法传递参数的方式不一样。

  1. //分享商品 list 列表
  2. .factory("shareGoodsListService",["$http",function($http){
  3. return {
  4. //得到所有的收货地址
  5. updateAddress : function(__scope__,addrid){
  6. //获取地址的值
  7. var Province = $("select[name='Province']").val();
  8. var City = $("select[name='City']").val();
  9. var Area = $("select[name='Area']").val();
  10. var formData = {
  11. id:addrid,
  12. name:__scope__.formData.name,
  13. mobile:__scope__.formData.mobile,
  14. province:Province,
  15. city:City,
  16. area:Area,
  17. address:__scope__.formData.address,
  18. zip:__scope__.formData.zip,
  19. submit:"submit"
  20. };
  21. $http.post("{:U('AddressInfo/editAddress')}",formData).success(function(response, status, headers, config){
  22. if(response.status == 1){
  23. alert("修改成功!");
  24. }
  25. })
  26. },
  27. getAddress:function(){
  28. //$http.get方法 传递参数使用的是 {params:jsonObj}
  29. $http.get("{:U('AddressInfo/editAddress')}",{
  30. params: {
  31. "id":id
  32. }
  33. })
  34. .success(function(response, status, headers, config){
  35. //获取地址的数据
  36. if(response.status == 1){
  37. __scope__.formData = {
  38. name:response.data.name,
  39. mobile:response.data.mobile,
  40. address:response.data.address,
  41. zip:response.data.zip
  42. };
  43. //默认收货地址的值
  44. new PCAS("Province","City","Area",response.data.province,response.data.city,response.data.area);
  45. }
  46. })
  47. }
  48. }
  49. }])

最新文章

  1. Windows_RTM_RC
  2. Unity3D使用经验总结 缺点篇
  3. POJ 2001 Shortest Prefix
  4. 坚持c++,真正掌握c++(2)
  5. [转]【基于zxing的编解码实战】精简Barcode Scanner篇
  6. RTX管理器服务运行状态空白
  7. HDU 5618 Jam's problem again
  8. JQuery中html()方法的注意事项
  9. oracle 选择最频繁出现之前,5文章数据
  10. ##7.Dashboard web管理界面-- openstack pike
  11. javaweb重定向的两种方式
  12. [Swift]LeetCode983. 最低票价 | Minimum Cost For Tickets
  13. Mysql优化系列(1)--Innodb重要参数优化
  14. 函数和常用模块【day05】:装饰器高潮(三)
  15. unity3D iTween的使用
  16. Linux SSH免登陆配置步骤
  17. Python第二弹--------类和对象
  18. golang的bytes.NewReader函数出现的问题
  19. oracle的字符集设置与乱码
  20. [Unity]游戏Inside中的Chromatic Aberration效果学习

热门文章

  1. i春秋-Phone number(union注入+hex转码)
  2. Android Jetpack 架构组件最佳实践之“网抑云”APP
  3. SpringSecurity:简单入门
  4. [C++]-string类的常用操作
  5. Linux 学习Shell一部分指令
  6. Windows10 + Chrome 触发蓝屏
  7. Linux 并发服务器编程(多进程)
  8. Java中Lambda表达式基础及使用详解
  9. ffmpeg第2篇:简单滤镜与复杂滤镜的区别
  10. SpringCache(redis)