我擔心這個問題可能有一個簡單的答案,但男孩我努力在 徒勞找到它!任何幫助,將不勝感激。我們已經將我們的Facebook應用程序 設置得很好,我們的操作和對象使用一個小腳本Java 工作得很好。但是...我想簡化我們網站的整個流程,通過在JavaScript中觸發動作的警告對話框中的 。簡化Facebook API腳本中的IF/ELSE
這就是我們現在已經有(工作):
<script type="text/javascript">
function postResonate_with_cambodia()
{
FB.api('/me/onemandala:resonate_with' +
'?intention=http://1mandala.org/1action-002','post ',
function(response) {
if (!response || response.error) {
if (confirm('You are not yet signed up for 1Mandala. 1Mandala uses Facebook Connect to showcase the amazing 1Actions folks are taking on our platform. We will redirect you now to the signup page...')) { window.location.href='http://www.1mandala.org/app-signup ' } else { void('') };;
} else {
if (confirm('You are resonating with the intention for 1SewingKit Cambodian Orphanage Empowerment. We will take you now to the project page to take action...')) { window.location.href='http://1mandala.org/1action-002 ' } else { void('') };;
}
});
}
</script>
的對話應該使它很清楚,應該是如何工作的。 但是,如果不是那些對話, 的腳本會將訪問者直接發送到Facebook註冊會話或 登錄頁面,這會不會更好?這是我的嘗試,不起作用。 :-(任何建議將 不勝感激。
<script type="text/javascript">
function postResonate_with_cambodia()
{
FB.api('/me/onemandala:resonate_with' +
'?intention=http://1mandala.org/1action-002','post',
function(response) {
if (!response || response.error)
{window.location.href='http://www.sign-up-page.com' } ;
} else {
{ window.location.href='http://1mandala.org/app-1action-002' } ;
}
});
}
</script>
請定義「不起作用」。它做什麼或不做什麼?你有什麼錯誤嗎?你正在檢查瀏覽器的控制檯嗎? – deceze
謝謝,很好的問題。我在Firefox調試器上得到的錯誤是「ReferenceError:postResonate_with_cambodia未定義@ http://1mandala.org/app:1」 – russs