title: Render a View after an AJAX call in asp.net MVC
body: <p>I'm trying to load a view after an ajax call. After the ajax call my action method will return a <code>view</code> which is going to be loaded after the call is success.</p>
  
  <p>AJAX I'm using</p>
  
  <blockquote>
    <blockquote>
      <p>function PostMethods(url, fname, lname, email) {</p>
  
  <pre><code>var userRegisterViewModel = {
      FirstName: fname,
      LastName: lname,
      Email: email
  };
  $.ajax({
      type: 'Post',
      dataType: "json",
      url: url,
      contentType: 'application/json',
      data: JSON.stringify(userRegisterViewModel),
  </code></pre>
      
      <p>//Success and error code</p>
  
  <pre><code>});}
  </code></pre>
    </blockquote>
  </blockquote>
  
  <p>My ajax calling an api method where I'm passing <code>fname</code>, <code>lname</code> and <code>email</code>. Now my api method successfully stores those data to database it will return a <code>View</code> if fails to store data it will return an error message which I can show to user in current view. In the HTML of the current view has an empty <code>&lt;spam&gt;</code> to show the error message.</p>
  
  <p>My Action Method is:</p>
  
  <pre><code>    public ActionResult RegisterAndLogin(UserRegisterViewModel model)
      {
          ActionResult returnNextPage = null;
          bool successToStoreData = SomeMethod(model);
          if (successToStoreData)
          {
              returnNextPage = RedirectToAction(string.Empty, "Home");
          }
          else
          {
              //Text message to show to the user
          }
          return returnNextPage;
      }
  </code></pre>
  
  <p>What code I should write to do this in AXAJ and action method</p>