ajax请求头添加参数
2024-10-21 05:46:31
在请求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)
}
});
最新文章
- iOS菜单滚动联动内容区域功能实现
- 异步httpCilent框架post提交到服务器
- Tomcat中的webapps中的web应用的文件结构
- Hibernate,JPA注解@Embeddable
- python视频教程:十分钟快速入门python
- SharePoint中修改密码的WEB Part之终极版:即可以修改AD,又可以修改本机用户密码的Web Part!!
- Web---JSP-EL表达式
- arm-linux-gcc编译器定义寄存器变量
- Myeclipse安装破解
- kali自动化清理缓存和日志
- net spider(python 网络爬虫)
- Ubuntu下搭建高匿HTTP代理(亲测可用)
- 20180821ImportContactFromExcel
- vul/0day/shellcode/payload/poc/exp
- MySQL--线程池(Thread Pool)
- 内核 platform_get_resource() 函数解析
- openstack查看命令的restful调用形式
- 「2017 山东一轮集训 Day5」字符串
- python with原理
- Swift 对象
热门文章
- 【大数据面试】【项目开发经验】Hadoop、Flume、Kafka、Hive、MySQL、Sqoop、Azkaban、Spark
- 18V转5V,15V转5V的LDO和DC芯片方案
- 最新 2022 年 Kubernetes 面试题高级面试题及附答案解析
- 《MySQL必知必会》之快速入门游标和触发器
- 在IQuery中使用除法提示";Numeric value does not fit in a System.Decimal";
- Transition 初步使用
- [python]《Python编程快速上手:让繁琐工作自动化》学习笔记1
- [编程基础] C和C++内置宏说明
- 一站式云原生体验|龙蜥云原生ACNS + Rainbond
- js获取天气插件