java href发送请求_如何使用location.href在get请求中添加Bearer Token?

目前我有发送身份验证令牌的所有ajax请求,但是我创建了一个导出到excel的服务,ajax不支持这个,我正在使用location.href来获取请求 . 有没有办法添加该令牌?

var getUrl = '/LandingView/ExportToExcel?excelHeader=' + excelHeader;

getUrl += '&companyId=' + $scope.options.companyId;

getUrl += '&startDate=' + $scope.options.startDate.toJSON();

getUrl += '&endDate=' + $scope.options.endDate.toJSON();

getUrl += '&page=' + $scope.options.page;

getUrl += '&stateFilter=' + $scope.options.stateFilter;

getUrl += '&rows=' + $scope.options.rows;

getUrl += '&alertFilter=' + $scope.options.alertFilter;

getUrl += '&mode=' + $scope.options.mode;

getUrl += '&showLanguages=' + $scope.options.showLanguages;

location.href = getUrl;

当我这样做时,我需要在标头中包含持票令牌 .

PS:我在后端使用ASP.NET MVC,在前端使用angularJS .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值