AngularJS$http查询删除特殊字符
我的问题很简单,每次我试图通过 $http.get()查询时,某些特殊字符被删除 就我而言,一封简单的电子邮件:emma@watson.com,在查询标题中成为emmawatson.com Angular在发送AJAX查询之前是否进行了某种验证 以下是我的Ajax代码:AngularJS$http查询删除特殊字符,angularjs,http,special-characters,Angularjs,Http,Special Characters,我的问题很简单,每次我试图通过 $http.get()查询时,某些特殊字符被删除 就我而言,一封简单的电子邮件:emma@watson.com,在查询标题中成为emmawatson.com Angular在发送AJAX查询之前是否进行了某种验证 以下是我的Ajax代码: $http.get(apiUrl, { params: { username: "Emma",
$http.get(apiUrl,
{
params: {
username: "Emma",
email: "emma@watson.com",
password: "1234"
}
})
.success(function(data) {
//do a simple return of the email on the server
console.log(data);//"emmawatson.com"
});
对于http请求,强烈建议在发送数据之前对其进行base64编码 尝试此代码并查看其是否有效:
$http.get(apiUrl, {
params: {
username: "Emma",
email: window.btoa("emma@watson.com"),
password: "1234"
}
})
.success(function (data) {
//do a simple return of the email on the server
console.log(data); //"emmawatson.com"
});
非常感谢,这通过服务器端的解码解决了我的问题:)没问题,我很乐意帮忙。请考虑接受这个答案: