title: JQuery function just call controller action the first time submit button is pressed
body: <p>I have a JQuery function called <code>InsertShowStudents()</code> which is executed correctly every time a submit button() is pressed. On success, I'm calling the other function <code>GetStudents()</code> to show the updated list of elements in the table. The <code>GetStudents()</code> function just calls the controller action the first time the button is pressed. After that, <code>InsertShowStudents()</code> continues inserting in the table but the <code>GetStudents()</code> function doesn't invoke the Action Method on the controller.. I've used a breakpoint to prove it, do you know what's happening?? </p>
  
  <p>JQuery code:</p>
  
  <pre><code>$(function () {
      $("#btnInsertStudent").click(function () {
          InsertShowStudents();
          return false;
      })
  
  })
  
  function InsertShowStudents() {   
      $.ajax({        
          type:"post",
          url: "/Students/InsertStudent/",
          data: { Name: $("#Name").val(), LastName: $("#LastName").val(), Age: $("#Age").val() }
      }).success(function () {        
          GetStudents();
          //clear the form
          $("#myform")[0].reset();
      }).error(function () {
          $("#divGetStudents").html("An error occurred")
      })
  }
  
  function GetStudents()
  {
      $.ajax({
          type: "get",
          url: "/Students/GetStudents"
      }).success(function (result) {
          $("#divGetStudents").html(result)
      })
  }
  </code></pre>
  
  <p>Controller Actions:</p>
  
  <pre><code>public ActionResult InsertStudent()
  {
      return View();
  }
  
  [HttpPost]
  //[ValidateAntiForgeryToken]
  public ActionResult InsertStudent(Student student)
  {
      if (ModelState.IsValid)
      {
          db.Students.Add(student);
          db.SaveChanges();
          return View();
      }
      return View(student);
  }
  
  public PartialViewResult GetStudents()
  {
      List&lt;Student&gt; students = db.Students.ToList();
      return PartialView(students);
  }
  </code></pre>