title: MVC Calling ActionResult Method from JavaScript
body: <p>I'm calling this ActionResult controller method from a JavaScript function on a View.  The function works fine, the ActionResult controller method runs fine but the final line where it is supposed to move to a different view does not happen.  I can step through the lines of code on the new view but after it steps through the lines on the new view the original view is still displayed.  Is the use of the $.get() call correct?  Or should I be using some other jquery method to call the controller.  I don't need to return anything from the controller in this instance, just run some database code and move to a new view.  </p>
  
  <p>Controller:</p>
  
  <pre><code>        if (ModelState.IsValid)
          {
              System.Web.Security.MembershipUser user = Membership.GetUser();
              var job = (from j in db.Jobs where j.ID == id select j).First();
              job.DriverMembershipUserName = user.UserName.ToString();
              job.JobStatus = "Purchased";
              ViewBag.PurchaseMessage = "Thank you for purchasing this job.";
              db.Entry(job).State = EntityState.Modified;
              db.SaveChanges();
  
              return View("JobDetail", job);                
          }
  </code></pre>
  
  <p>JavaScript call from original view page:</p>
  
  <pre><code>var url = "/Job/PurchaseJobFinalize/" + JobID;
  $.get(url, function () { });
  </code></pre>