在请求ajax时 ,有时后台要求在请求头里边上参数 ,这种情况下一般都是在原生APP项目当中,因为要在登录状态下才,所有要传token和登录id,

var token = localStorage.getItem('token')||'';
var identity = localStorage.getItem('identity')||'';
$.ajax({
type: params.type || 'post',
url: dev.APIURL + params.url || null,
dataType:'json',
data: params.data || null,
headers: {
  'token':token,
'identity':identity,
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
vue.$indicator.close()
if(res.code != 200 && res.msg){
vue.$toast(res.msg);
}
resolve(res)
},
error: function (err) {
reject(err)
     }
});

  

  

最新文章

  1. iOS菜单滚动联动内容区域功能实现
  2. 异步httpCilent框架post提交到服务器
  3. Tomcat中的webapps中的web应用的文件结构
  4. Hibernate,JPA注解@Embeddable
  5. python视频教程:十分钟快速入门python
  6. SharePoint中修改密码的WEB Part之终极版:即可以修改AD,又可以修改本机用户密码的Web Part!!
  7. Web---JSP-EL表达式
  8. arm-linux-gcc编译器定义寄存器变量
  9. Myeclipse安装破解
  10. kali自动化清理缓存和日志
  11. net spider(python 网络爬虫)
  12. Ubuntu下搭建高匿HTTP代理(亲测可用)
  13. 20180821ImportContactFromExcel
  14. vul/0day/shellcode/payload/poc/exp
  15. MySQL--线程池(Thread Pool)
  16. 内核 platform_get_resource() 函数解析
  17. openstack查看命令的restful调用形式
  18. 「2017 山东一轮集训 Day5」字符串
  19. python with原理
  20. Swift 对象

热门文章

  1. 【大数据面试】【项目开发经验】Hadoop、Flume、Kafka、Hive、MySQL、Sqoop、Azkaban、Spark
  2. 18V转5V,15V转5V的LDO和DC芯片方案
  3. 最新 2022 年 Kubernetes 面试题高级面试题及附答案解析
  4. 《MySQL必知必会》之快速入门游标和触发器
  5. 在IQuery中使用除法提示"Numeric value does not fit in a System.Decimal"
  6. Transition 初步使用
  7. [python]《Python编程快速上手:让繁琐工作自动化》学习笔记1
  8. [编程基础] C和C++内置宏说明
  9. 一站式云原生体验|龙蜥云原生ACNS + Rainbond
  10. js获取天气插件