我得到了进行 ajax 调用 (GET) 的服务。
var _getMemeValues = function(category_id, attribute_id) {
return $http.get('/api/meme_values?category_id='+category_id +'&attribute_id='+attribute_id);
};
当我进行该调用时,url 会像这样进行编码。 http://localhost:8080/api/meme_%E2%80%8Bvalues?category_id=MLB1468&%E2%80%8Battribute_id=MLB1234
我该如何解决这个问题?我尝试用 toString()、decodeURIComponent 转换它,但没有用
最佳答案
你的字符串中有一个控制字符( LRM
)
'/api/meme_values?category_id='+category_id +'&attribute_id='
here ^ and here ^
即在 meme_
之后和 attribute_id=
之前,只需将其删除即可。
这个字符一般来自ms word之类的编辑器。
关于javascript - angularjs - url在ajax调用中被编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39791542/