title: Using Ajax, textbox does not clear on submit in MVC
body: <p>I need your help.  I am using AjaxBeginform to submit a question in a small text field.  I can submit the question, and it posts fine to the db, however the question never clears.  I am using Ajax because I don't want the entire page to post.  I have tried using this.rest(); but that works in IE but it won't work in Firefox and Chrome.  I have tried  $('#question').reset(); But that still isn't working.  I am sure it's something I am doing incorrectly.  </p>
  
  <p>Here is my code below.  Thank you for your help. </p>
  
  <p><strong>This is my Scripts at the top of the page:</strong></p>
  
  <pre><code>    &lt;script type="text/javascript" src="~/Scripts/jquery-migrate-    1.2.1.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  
  
  
  
  
  
  
  
  <p><strong>Here is the AjaxBeginForm along with the textbox</strong> </p>
  
  <pre><code>     @using (Ajax.BeginForm("SendQuestion", new { PresId = Model.PresentationID, catalogId = ViewBag.CatalogId }, new AjaxOptions
          {
              HttpMethod = "Post",
              UpdateTargetId = "questionTxt",
              OnBegin = "OnBegin",
              OnSuccess = "OnSuccess",
              OnFailure = "OnFailure"
  
          }))
              {
  
                  &lt;fieldset id="question"&gt;
                      &lt;p&gt;
                          &lt;textarea id="questionTxt" style="font-size:12px" cols="20" rows="6" name="questionTxt" onclick="javascript:removeTextAreaWhiteSpace(this);"&gt;&lt;/textarea&gt;
                      &lt;/p&gt;
  
  
                      &lt;button id="question-btn" type="submit"&gt;Submit&lt;/button&gt;
                  &lt;/fieldset&gt;
  
              }
  </code></pre>
  
  <p><strong>Here is my function for OnSuccess</strong></p>
  
  <pre><code>  function OnSuccess() {
      alert("Your question has been submitted.");
      $('#question').val('');
  }
  </code></pre>
  
  <p><strong>Here is my controller</strong></p>
  
  <pre><code>    public bool SendQuestion(string questionTxt, long PresId, long catalogId)
      {
          try
          {
              var db = new ODTEntities();
              var pres = db.Presentations.FirstOrDefault(i =&gt; i.PresentationID == PresId);
              var subject = db.Catalogs.FirstOrDefault(i =&gt; i.CatalogID == catalogId).CatalogCode + " - " + pres.Title + " - " + pres.Presenter.PresenterName;
              Utils.AddQuestionToDB(db, PresId, catalogId, Utils.GetAttendeeId(), questionTxt);
              string body = "This question : " + Environment.NewLine + questionTxt + Environment.NewLine + " was sent by " +
                            User.Identity.Name;
              var catalog = db.Catalogs.FirstOrDefault(i =&gt; i.CatalogID == catalogId);
              if (!string.IsNullOrEmpty(catalog.QuestionsEmail))
                  Helper.SendMail(body, subject, catalog.QuestionsEmail, "");
              else
                  Helper.SendMail(body, subject);
          }
          catch (Exception)
          {
              return false;
          }
          return true;
      }
  </code></pre>
  
  <p>Now like I stated earlier, I have tried this one, and it will clear in IE but not int Firefox or Chrome.  So when I submit the form the pop up comes back with Your question has been submitted, while the popup is visible, the question changes to true and then one you click ok on the popup window, the textbox is cleared in IE: </p>
  
  <pre><code>      function OnSuccess() {
      alert("Your question has been submitted.");
      $('#question').val('');
      this.reset();
  }
  </code></pre>
  
  <p>If someone can tell me what I am doing incorrectly, that would be greatly appreciated.  Thank you. </p>