以下是使用 URL 中的空格进行重定向,我正在尝试使用 encodeURIComponent 将其删除。
谁能告诉我我做错了什么?
编辑:根据下面的建议,我将发布整个脚本...
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $AppID; ?>',
oauth : true,
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
function fb_login(){
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
//Ajax Loader
$.post("addtodb.php",
{name: response.name, email:response.email},
function(data) {
window.location.href = "next.php?name="+escape(response.name)+"&email="+(response.email); //redirect after post callback
})
});
} else {
}
}, {
scope: 'email'
}
);
}
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>