码迷,mamicode.com
首页 > Web开发 > 详细

js传递参数中包含+号时的处理方法

时间:2016-12-21 18:20:20      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:code   cti   处理   alert   eth   传递   uri   方法   replace   

encodeURI(url).replace(/\+/g, ‘%2B‘)

例子:

$scope.getAnesthesiawaystatistical = function (annual, anesthesiaMethodRep) {
var Anesthesiurl = "/api/v1/AnesthesiAwayStatistical/GetAnesthesiAwayStatisticalCount?anesthesiaMethodRep=" + "‘" + anesthesiaMethodRep + "‘" + "&annual=" + annual;
alert(encodeURI(Anesthesiurl).replace(/\+/g, ‘%2B‘));
$http.get(encodeURI(Anesthesiurl).replace(/\+/g, ‘%2B‘)).success(function (data) {

if (data.has_val) {
$scope.AnesthesiAwayStatisticalList = data.result;

console.log($scope.AnesthesiAwayStatisticalList);
}
});
}

js传递参数中包含+号时的处理方法

标签:code   cti   处理   alert   eth   传递   uri   方法   replace   

原文地址:http://www.cnblogs.com/zhangxiaolei521/p/6208491.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!