Want to show image and disable submit button while ajax submit
<p>I am posting image and text data that is working properly, but during posting i want to show images 
and same time  i want to disable post button, after form submission image should be hidden and post button should be  enabled.</p>

<p>following is my code, here i am showing image and disabling post button but it is not working.</p>

<pre><code>&lt;form id="own_message_post" action="ownmessages" method="post"&gt; 
      &lt;textarea name="message" rows="4" cols="45" id="text_message" placeholder="Update your status"&gt;&lt;/textarea&gt; 
        &lt;img src="images/loader.gif" alt="posting" id="loading_img" style="visibility: hidden;"&gt;
        &lt;input id="fileupload" type="file" name="user_post_image" data-url="ownmessages"&gt;
          &lt;select name="msg_visibility"&gt;
             &lt;option value="public"&gt;Public&lt;/option&gt;
             &lt;option value="friends"&gt;Friends&lt;/option&gt;
             &lt;option value="me"&gt;Me only&lt;/option&gt;
          &lt;/select&gt;
       &lt;input type="submit" value="Post" id="submit_form_button"&gt; 
       &lt;/form&gt;

&lt;script&gt; 
        // wait for the DOM to be loaded 
         $(document).ready(function() { 
         // bind 'myForm' and provide a simple callback function 
          $('#submit_form_button').click(function() {
           var a= $('#text_message').val();
           if(a=='' || a.length==0)
             {
                   $('#err').text("Please post your status");
                    return false;
               }
           if(a.length&lt;10)
              {
                   $('#err').text("minimum 10 characters are required");
                   return false;
              }

        });
      $('#own_message_post').ajaxForm(function(data) {

              $("#loading_img").css("visibility", "visible");
              $('#submit_form_button').attr("disabled", true);
              $('#messages_and_pages').html(data);
              $('#text_message').val("");
              $('#fileupload').val("");
              $('#submit_form_button').removeAttr('disabled');
              $("#loading_img").css("visibility", "hidden");

          }); 
     }); 
&lt;/script&gt;
</code></pre>
