views:

109

answers:

1

Hi, I am trying to post something on a facebook users feed and then afterwards redirect the user to another page, but it seems like the page just keeps reloading without any promt for sending user feed.

FB.Connect.showFeedDialog(1111111, null, null, null, null, null, redirectTo(), null, null);
function redirectTo()
{
     window.top.location = "/mywebsite";
}

if I just call the show feed with the id it works properly.

    FB.Connect.showFeedDialog(1111111, null, null, null, null, null, redirectTo(), null, null);

Anyone who knows why the first lines of code keeps reloading the page in an infinitive loop?

+2  A: 

When registering the callback function, you want to pass the reference to the function and not actually call the function. Remove the parentheses from redirectTo in your first line:

FB.Connect.showFeedDialog(1111111, null, null, null, null, null, redirectTo, null, null);
function redirectTo(){
     window.top.location = "/mywebsite";
}
great_llama
I thought I tried that already, but apparently not :)
Dofs