title: Add Category Dynamically ASP.Net 4 MVC3 C#
body: <p>I am working on creating a blog with ASP.Net 4, MVC 3, Razor and C#.
  There are 2 seperate tables. 1 for the actual blog post and a relationship table for categories.
  The categories displays as a dropdown.
  I want to add the ability to add a new category using Ajax so the user does not lose what they have already entered into the form.
  What would be the best way to accomplish this?
  Here is what I have right now.</p>
  
  <p>Controller Code</p>
  
  <pre><code>public ActionResult Create()
      {
          ViewBag.category_id = new SelectList(_db.Categories, "id", "category_name");
          return View();
      } 
  </code></pre>
  
  <p>Razor View</p>
  
  <pre><code>@model NPP.Models.News
  
  @{
      ViewBag.Title = "Create News Item";
  }
  
  &lt;h2&gt;Create News Item&lt;/h2&gt;
  
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  
  @using (Html.BeginForm()) {
  @Html.ValidationSummary(true)
  &lt;fieldset&gt;
      &lt;legend&gt;News&lt;/legend&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.news_title, "Title")
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.news_title)
          @Html.ValidationMessageFor(model =&gt; model.news_title)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.news_content, "Content")
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextAreaFor(model =&gt; model.news_content)
          @Html.ValidationMessageFor(model =&gt; model.news_content)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.news_teaser, "Teaser (optional)")
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextAreaFor(model =&gt; model.news_teaser)
          @Html.ValidationMessageFor(model =&gt; model.news_teaser)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.category_id, "Category")
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.DropDownList("category_id", String.Empty)
          @Html.ValidationMessageFor(model =&gt; model.category_id)
      &lt;/div&gt;
  
      &lt;p&gt;
          &lt;input type="submit" value="Create" /&gt;
      &lt;/p&gt;
  &lt;/fieldset&gt;
  }
  
  &lt;div&gt;
      @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanks for any help in advance. My layout page includes jquery which I would prefer to use.</p>