Cannot able to submit the form automatically
<p>I have written this code. Here after logging into facebook, the document needs to redirect to check3.php. Here is the code..</p>

<pre><code>  &lt;html&gt;
    &lt;body&gt;
        &lt;div id="header"&gt;  
        &lt;h1&gt;&lt;a href="index.php"&gt;ReviewBox&lt;/a&gt;&lt;/h  
        &lt;ul id="nav"&gt; 
        &lt;li&gt;&lt;a href="#"&gt;Real Reviews For Real People&lt;/a&gt;&lt;/li&gt;
        &lt;li style="background: url(images/request.png);display:block; margin : 0 10px 0 0;float:right;text-indent: -9999px; width : 200px; height: 30px;"&gt;&lt;a href="request.php"&gt;Request Review From Friends&lt;/a&gt;&lt;/li&gt;&lt;br/&gt;

        &lt;/ul&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;
        &lt;div id="container"&gt;
           &lt;div id="content"&gt;

           &lt;p&gt;Someone is always out there, waiting to know what you have to say.
           So why not speak out with ReviewBox?&lt;/p&gt;&lt;br/&gt;

        &lt;h6&gt;Get Started!&lt;/h6&gt;&lt;br/&gt;&lt;br/&gt;
        &lt;center&gt;
            &lt;div id="fb-root"&gt;&lt;/div&gt;
        &lt;script language="javascript" src="json2.js"&gt; &lt;/script&gt;
        &lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt;
        &lt;script&gt;
          FB.init({ 
            appId:'xxxxxxxxxxxx', cookie:true, 
            status:true, xfbml:true
          });
        &lt;/script&gt;
       &lt;fb:login-button perms="read_stream,publish_stream,email,offline_access"&gt;
        Login with Facebook
        &lt;/fb:login-button&gt;

        &lt;br/&gt;&lt;br/&gt;
        &lt;p&gt;Like ReviewBox :&lt;/p&gt;&lt;br/&gt;&lt;center&gt;
        &lt;fb:like href="https://www.facebook.com/apps/application.php?id=xxxxxxxxxx" send="false" width="220" show_faces="true" font=""&gt;&lt;/fb:like&gt;&lt;/center&gt;

         &lt;script&gt; 
          FB.api('/me',function(response) {

         setCookie("fbname",response.name,365);
         setCookie("fbid",response.id,365);
         setCookie("checker",1,1);
         var username=getCookie("fbid");

        if (username!="undefined" &amp;&amp; username!="")
         {
           alert("Welcome Again, " + response.name + "!");
           sample();
           //window.location.reload();  
         }
         else 
         {
           alert("Welcome Guest! Please Login with Facebook To Get Started With ReviewBox!");
           username=response.id;
           username2=response.name;
           if (username!=null &amp;&amp; username!="")
           {
            setCookie("fbid",username,365);
            setCookie("fbname",username2,365);
            setCookie("checker",1,1);
           }
        }
     });


    function sample()
    {
    document.form1.submit();
    }
    &lt;/script&gt;

    &lt;form name="form1" action="check3.php" method="post"&gt;
    &lt;input type="hidden" name="fb_user" id="fb_user" value="" /&gt;
    &lt;/form&gt;

    &lt;/body&gt;
    &lt;/html&gt;
</code></pre>

<p>But when I run this code and after logging into facebook the code inside sample() function is not executed.. as a result my page does not redirects to check3.php.
Any suggestion?</p>
