0

我很困惑将http://字符串传递给 url,因为它被剥离到

http%3A%2F%2F 

我试过..使用 encodeURIComponent(http://)

但这也不起作用..我正在尝试将网址传递到此处:

https://www.facebook.com/sharer/sharer.php?url=

这是我的代码不起作用:

$(document).on('click', '.fb', function(e) {

var findfb = $('.fb').parent().parent().parent().find(".zoomy").attr("src");

var facebook_url = 'http://www.facebook.com/sharer.php?url=http://www.site.com/folder1/'+encodeURIComponent(findfb)+
  '&title='+encodeURIComponent('title of page');

    window.open(facebook_url); 


});
4

2 回答 2

1

只需简单地执行以下操作:

var facebook_url = 'http://www.facebook.com/sharer.php?url=' + encodeURIComponent('http://www.site.com/folder1/' + findfb +'&title=' + 'title of page');
于 2013-06-02T03:43:41.050 回答
0

var facebook_url = 'http://www.facebook.com/sharer.php?url=' + encodeURIComponent('http://www.site.com/folder1/' + findfb) + '&title=' + encodeURIComponent('title of page');

于 2013-06-02T03:11:52.007 回答