对窗口进行编码时遇到问题.位置.href.
trouble encoding a window.location.href
以下内容是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>
escape('foo bar');//foo%20bar
encodeURI('foo bar');//foo%20bar
encodeURIComponent('foo bar');//foo%20bar
这三个例子效果很好。如果没有,请检查 fi 代码上没有其他导致错误的内容或在此处发布整个脚本
相关文章:
- 将PHP变量传递给jQuery时遇到问题
- 将jQuery转换为用户脚本的普通Javascript时遇到问题
- 将子文档推送到父数组时遇到问题
- JQuery FullCalendar在从ajax成功调用rerenderEvents时遇到问题
- 在将javascript附加到我的html中时遇到问题
- 为什么我在以编程方式打开窗口时遇到问题
- 在将缩略图链接到模态时遇到问题
- 使用 ng 模型获取数据时遇到问题
- 是否有其他人在设计Twitter Typeahead时遇到问题'的搜索栏
- 使用jquery进行整数比较时遇到问题
- 使用PhantomJS下载动态web内容时遇到问题
- 设置RequireJS时遇到问题
- 让Javascript在SharePoint 2010上运行时遇到问题
- I'我在react.js中编写for循环时遇到问题
- 通过jQuery获取上传的文件名时遇到问题
- 我在启动我的节点时遇到问题.js IRC 机器人
- Ruby on Rails 4:在 Rails Web 应用程序中添加 Javascript 文件时遇到问题
- 从谷歌地图自定义控件打开离子模态时遇到问题
- 在使用 YAML 和 Google App Engine 时遇到问题
- 在 Chrome 扩展程序中将鼠标悬停在广告上使用时遇到问题