title: Jquery redirect after php login
body: <h1>The Problem</h1>
  <p>I can't seem to get the javascript to redirect after the php has echoed &quot;Success&quot;.</p>
  <p>Im basically just trying to make it where the javascript post my form data and then the usesr is redirected to their account page. I did have this being done via php, but I wanted the luxury of being able to stay on the same page while logging in.</p>
  <h1>The Javascript</h1>
  <pre><code> &lt;script&gt;
  $(document).ready(function() {
  //When the form with id=&quot;myform&quot; is submitted...
  $(&quot;#login_form&quot;).submit(function() {
       //Send the serialized data to formProcessor.php.
       $.post(&quot;login.php&quot;, $(&quot;#login_form&quot;).serialize(),
       //Take our repsonse, and replace whatever is in the &quot;formResponse&quot;
       //div with it.
      function(data) {
            if(data == &quot;Success&quot;){
            location.href=&quot;home&quot;;
        }
       }
  );
  return false;
  });
  });
  &lt;/script&gt;
  </code></pre>