I want to fire an ajax call on submit button click. And at the mean time I just want to hide the submit button and show a gif image till the ajax is done. But the submit button is taking some time to hide after it has been clicked. I don't know but why ???
 function exemptProductAjaxCall() {
      $("#delistSubmit").hide("fast");
      $("#edit-icon").show("fast");
      var days, pId, remarks;
      days = $("#exemptDays").val();
      pId = $('#exempPid').val();
      remarks = $("#remarks").val();
      pIdParam = [pId];
      $.ajax({
          type: "POST",
          url: "abc.php",
          cache: false,
          async: false,
          data: {dispatch: 'myphp.pidExempt', pIds: pIdParam, exemptDays: days, remarks: remarks, callAjax: 1},
          error: function (data, textStatus, jqXHR)
          {
              //error msg
              var err = eval("(" + data.responseText + ")");
              alert('Ajax Error: ' + err.Message);
          }
      }).done(function (msg) {
          var resPonse = JSON.parse(msg);
          if (resPonse['success'] == 1)
          {
              alert('Success: ' + resPonse['message']);
              $("#exemptDays").val(1);
              $('#exempPid').val('');
              $("#remarks").val('');
          } else
          {
              if (typeof resPonse['message'] === 'undefined')
                  alert('Error: Unknown Error');
              else
                  alert('Error: ' + resPonse['message']);
          }
      });
      $("#edit-icon").hide();
      $("#delistSubmit").show();
  } <input type="button" id="delistSubmit" value="Submit" onClick="exemptProductAjaxCall();" style="padding-bottom: 41px;">
 <img id="edit-icon" style="-webkit-user-select:none;height:36px;width:36px;float:left;margin-right:40px;display:none;" src="banners/ajax-load-black.gif"> 
     
     
     
     
    