我按照這個教程創建我自己的社交分享按鈕與計數器: Social Share Tutorial 而我不明白爲什麼社交分享計數不會通過。社交分享計數器問題
這是一個HubSpot站點和頁面是here
我還設置了一個fiddle 顯示我正在使用的代碼。
任何有識之士將不勝感激!
This是在js中調用的php文件。
的JS:
function get_social_counts() {
var thisUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
$.ajax({
type: "GET",
url: 'http://cdn2.hubspot.net/hubfs/169677/social_sharing/get_social_counts.php? thisurl='+thisUrl,
dataType: "json",
success: function (data){
$('a.post-share.twitter span').html(data.twitter);
$('a.post-share.facebook span').html(data.facebook);
$('a.post-share.gplus span').html(data.gplus);
$('a.post-share.stumble span').html(data.stumble);
}
});
}
$(document).ready(function(){
get_social_counts();
});
感謝
就像最初的想法一樣,你的URL中有2個空白是故意的嗎?雖然空格通常無關緊要,但當它們被包含在字符串中時,它們當然很重要。我會看看你發佈的內容的其餘部分,如果我看到其他內容,請告訴我們。 – Fata1Err0r