Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS$http查询删除特殊字符_Angularjs_Http_Special Characters - Fatal编程技术网

AngularJS$http查询删除特殊字符

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()查询时,某些特殊字符被删除

就我而言,一封简单的电子邮件:emma@watson.com,在查询标题中成为emmawatson.com

Angular在发送AJAX查询之前是否进行了某种验证

以下是我的Ajax代码:

$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"
});

非常感谢,这通过服务器端的解码解决了我的问题:)没问题,我很乐意帮忙。请考虑接受这个答案: