title: using ajax to submit form from another page?
body: <p>I have a form on one page with <code>action="/profile"</code> and I am trying to make an Ajax code to make it update without page refresh and without having to go to that page. Any ideas on how I go about this or if I am actually do it right or what?</p>
  
  <pre><code>$(function() {  
     $('.error').hide();  
       $("#submit").click(function() {  
  // validate and process form here  
  $('.error').hide();  
    var stat = $("#profile_field_13_5").val();  
      if (stat == "") {  
    $("#name_error").show();  
    $("#profile_field_13_5").focus();  
    return false;  
  }  
  var dataString = 'stat='+ stat ;
   $.ajax({  
            type: "POST",  
            url: "/profile.php",  
            data: dataString,  
            success: function() {  
       $('#statsucces').show();
           window.setTimeout("closeSuccess();", 10000);
  
           function closeSuccess(){
           document.getElementById("statsuccess").style.display=" none";
       }
        });  
    });  
   return false;  
    });
  });
  </code></pre>
  
  <p>This is the input field I am trying to use to do a status update </p>
  
  <p><code>#profile_field_13_5</code> and the form action again is <code>/profile.php</code></p>
  
  <p>Thanks for whomever helps me</p>