title: Save button executes a random number of ajax calls
body: <p>As the title says I have a problem with a save button which saves many times. Sometimes it works as it should and sometimes saves 2,3,5,13 times. The number is different everytime.</p>
  
  <blockquote>
    <p>Some parts of the code will be hidden for copyright reasons. Sorry ;(</p>
  </blockquote>
  
  <p>At first I thought it could be my mouse clicking more than once on the button so I added the following code to the jquery that calls the method in the Controller:</p>
  
  <pre><code>@(vm).saveobject= function() {
       $("#savebutton").attr('disabled', 'disabled');
       var url = //Some valid Url      
  
       var entity = {//code here
       };
  
       $.ajax({
           url: url,
           type: 'post',
           contentType: 'application/json',
           dataType: 'json',
           data: JSON.stringify(entity),
           success: function (resultado) {
               var result = resultado.result.toString();
               if (result.toLowerCase() == "true".toLowerCase()) {
                   $('#Grid').data("tGrid").rebind()
                   alert("Blablabla");
               } else {
                   alert(resultado.error);
               }
           }
       });
       $("#saveButton").removeAttr('disabled');
   };
  </code></pre>
  
  <p>Code of the controller:</p>
  
  <pre><code>    [HttpPost]
      public virtual JsonResult Save(Onject o)
      {
          string error = string.Empty;
          if (//Conditions)
          {
              Repository.SaveOrUpdate(o);
              return Json(new { result = true ,error = error}, JsonRequestBehavior.AllowGet);
          }
          else {
              error = "Blablablabla";
              return Json(new { result = false, error = error }, JsonRequestBehavior.AllowGet);
          }
      }
  </code></pre>
  
  <p>But that didn't work. I read the following question <a href="https://stackoverflow.com/questions/4250604/how-do-i-prevent-multiple-form-submission-in-net-mvc-without-using-javascript">How do I prevent multiple form submission in .NET MVC without using Javascript?</a> but I don't know if might be helpful as the method already implements [HttpPost]</p>
  
  <p>Do you have any idea?</p>
  
  <p>Thanks in advance ;)</p>