title: loading Gif not working Jquery ajax
body: <p>When i submit or click the form button i want to hide the button and show the loading gif and display the message from the php script. </p>
  
  <p>This is my code..</p>
  
  <pre><code>$("button#sub").click(function() {
  
  $("div#error").css("color", "red");
  
  if ($("#username").val() == '' || $("#password").val() == '') {
  
      $("div#error").html("Please enter your account");
  
  }else
      $.post( $("#loginForm").attr("action"), 
              $("#loginForm :input").serializeArray(), 
              function(data) { 
               $("button#sub").delay(100).show(0);
               $("div#load").delay(100).hide(0);
               $("div#error").html(data); 
              });
  
  $("#loginForm").submit(function() {
      return false;
  });
  </code></pre>
  
  <p>});</p>