title: jQuery Ajax form submit not working .Net MVC
body: <p>I have a simple Subscribe form with 1 field. I am looking to submit this form using jQuery Ajax. Here is the code.</p>
  <ol>
  <li>Subscriber Model Class</li>
  </ol>
  <pre><code>public class Subscriber
      {
  
          [Key]
          public int SubsID { get; set; }
          [Display(Name = &quot;Email address&quot;)]
          [Required(ErrorMessage = &quot;The email address is required&quot;)]
          [EmailAddress(ErrorMessage = &quot;Invalid Email Address&quot;)]
          public string Email { get; set; }
      }
  </code></pre>
  <ol start="2">
  <li>Form is a part of Default Shared Lay out under the shared folder, and here is how It looks</li>
  </ol>
  <pre><code>                  &lt;div class=&quot;col-md-4&quot;&gt;
                      &lt;strong&gt;Subscribe to our Mailing List!&lt;/strong&gt;
                      &lt;form class=&quot;shadow-lg p-4 mb-5 bg-white rounded&quot; id=&quot;formSub&quot;&gt;
                          &lt;input type=&quot;text&quot; name=&quot;Email&quot; id=&quot;Email&quot; placeholder=&quot;Email here..&quot; /&gt;
                          &lt;button id=&quot;click&quot;&gt;Subscribe&lt;/button&gt;
                      &lt;/form&gt;
                     &lt;span id=success&gt;Show Success message here&lt;span&gt;
                     &lt;span id=error&gt;Show Error message here&lt;span&gt;
                  &lt;/div&gt;
  </code></pre>
  <ol start="3">
  <li>Here is the Full HTML CODE</li>
  </ol>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot; /&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;title&gt;@ViewBag.Title&lt;/title&gt;
      &lt;meta name=&quot;description&quot; content=&quot;@Html.Raw(ViewBag.MetaDesc)&quot;/&gt;   
      &lt;link href=&quot;https://use.fontawesome.com/releases/v5.0.6/css/all.css&quot; rel=&quot;stylesheet&quot;&gt;
      &lt;link href=&quot;~/Content/font-awesome.min.css&quot; rel=&quot;stylesheet&quot; /&gt;
      &lt;link href=&quot;~/Content/SocialShare.css&quot; rel=&quot;stylesheet&quot; /&gt;
      @Styles.Render(&quot;~/Content/css&quot;)
      @Scripts.Render(&quot;~/bundles/modernizr&quot;)
      &lt;meta name=&quot;google-site-verification&quot; content=&quot;Z3J9-GHgzfRAHkIM_68WrYr3qQTNJMXJBKj7ZWnh6wM&quot; /&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;nav class=&quot;navbar navbar-expand-lg navbar-dark bg-primary&quot; style=&quot;background: #158cba !important;&quot;&gt;
          &lt;a class=&quot;navbar-brand&quot; href=&quot;#&quot;&gt;Coupon4All &lt;i class=&quot;fa fa-tags&quot;&gt;&lt;/i&gt;&lt;/a&gt;
          &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#navbarColor01&quot; aria-controls=&quot;navbarColor01&quot; aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;
              &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;
          &lt;/button&gt;
  
          &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarColor01&quot;&gt;
  
              @if (Request.IsAuthenticated)
              {
                  &lt;ul class=&quot;navbar-nav mr-auto&quot;&gt;
                      &lt;li class=&quot;nav-item active&quot;&gt;
                          &lt;a class=&quot;nav-link&quot; href=&quot;/&quot;&gt;Home &lt;span class=&quot;sr-only&quot;&gt;(current)&lt;/span&gt;&lt;/a&gt;
                      &lt;/li&gt;
                      &lt;li class=&quot;nav-item dropdown&quot;&gt;
                          &lt;a class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; id=&quot;navbarDropdown&quot; role=&quot;button&quot; data-toggle=&quot;dropdown&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&gt;
                              Store
                          &lt;/a&gt;
                          &lt;div class=&quot;dropdown-menu&quot; aria-labelledby=&quot;navbarDropdown&quot; style=&quot;background: #158cba;&quot;&gt;
                              &lt;p&gt;@Html.Action(&quot;StoreNavPartial&quot;, &quot;Shop&quot;)&lt;/p&gt;
  
                          &lt;/div&gt;
                      &lt;/li&gt;
  
                      &lt;li class=&quot;nav-item dropdown&quot;&gt;
                          &lt;a class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; id=&quot;navbarDropdown&quot; role=&quot;button&quot; data-toggle=&quot;dropdown&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&gt;
                              Category
                          &lt;/a&gt;
                          &lt;div class=&quot;dropdown-menu&quot; aria-labelledby=&quot;navbarDropdown&quot; style=&quot;background: #158cba;&quot;&gt;
                              &lt;p&gt;@Html.Action(&quot;CategoryNavPartial&quot;, &quot;Shop&quot;)&lt;/p&gt;
  
                          &lt;/div&gt;
                      &lt;/li&gt;
  
                      &lt;li class=&quot;nav-item&quot;&gt;
                          &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;Our Blog&lt;/a&gt;
                      &lt;/li&gt;
  
                      &lt;li class=&quot;nav-item&quot;&gt;
                          &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;MyProfile&lt;/a&gt;
                      &lt;/li&gt;
                  &lt;/ul&gt;
  
                  using (Html.BeginForm(&quot;Logout&quot;, &quot;Home&quot;, FormMethod.Post, new { id = &quot;logoutForm&quot;, }))
                  {
                      @Html.AntiForgeryToken()
                      &lt;ul class=&quot;nav navbar-nav navbar-right&quot;&gt;
  
                          &lt;li style=&quot;padding:5px;&quot;&gt;&lt;a href=&quot;javascript:document.getElementById('logoutForm').submit()&quot; class=&quot;btn btn-warning&quot;&gt;Log off&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  }
  
                  if (User.IsInRole(&quot;Admin&quot;))
                  {
                      &lt;ul class=&quot;nav navbar-nav&quot;&gt;
                          &lt;li class=&quot;nav-item&quot;&gt;
                              &lt;a class=&quot;btn btn-primary&quot; href=&quot;/Admin/Store/AllStore&quot; target=&quot;_blank&quot; style=&quot;margin: 5px;&quot;&gt;ADMIN&lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  }
              }
              else
              {
                  &lt;ul class=&quot;navbar-nav mr-auto&quot;&gt;
                      &lt;li class=&quot;nav-item active&quot;&gt;
                          &lt;a class=&quot;nav-link&quot; href=&quot;/&quot;&gt;Home &lt;span class=&quot;sr-only&quot;&gt;(current)&lt;/span&gt;&lt;/a&gt;
                      &lt;/li&gt;
                      &lt;li class=&quot;nav-item dropdown&quot;&gt;
                          &lt;a class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; id=&quot;navbarDropdown&quot; role=&quot;button&quot; data-toggle=&quot;dropdown&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&gt;
                              Store
                          &lt;/a&gt;
                          &lt;div class=&quot;dropdown-menu&quot; aria-labelledby=&quot;navbarDropdown&quot; style=&quot;background: #158cba;&quot;&gt;
                              &lt;p&gt;@Html.Action(&quot;StoreNavPartial&quot;, &quot;Shop&quot;)&lt;/p&gt;
  
                          &lt;/div&gt;
                      &lt;/li&gt;
  
                      &lt;li class=&quot;nav-item dropdown&quot;&gt;
                          &lt;a class=&quot;nav-link dropdown-toggle&quot; href=&quot;#&quot; id=&quot;navbarDropdown&quot; role=&quot;button&quot; data-toggle=&quot;dropdown&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&gt;
                              Category
                          &lt;/a&gt;
                          &lt;div class=&quot;dropdown-menu&quot; aria-labelledby=&quot;navbarDropdown&quot; style=&quot;background: #158cba;&quot;&gt;
                              &lt;p&gt;@Html.Action(&quot;CategoryNavPartial&quot;, &quot;Shop&quot;)&lt;/p&gt;
  
                          &lt;/div&gt;
                      &lt;/li&gt;
  
                      &lt;li class=&quot;nav-item&quot;&gt;
                          &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;Our Blog&lt;/a&gt;
                      &lt;/li&gt;
  
                  &lt;/ul&gt;
  
                  &lt;ul class=&quot;navbar-nav navbar-right&quot;&gt;
                      &lt;li class=&quot;nav-item&quot;&gt;
                          &lt;a class=&quot;nav-link btn btn-success&quot; style=&quot;margin: 5px;&quot; href=&quot;@Url.Action(&quot;Signup&quot;,&quot;Home&quot;)&quot;&gt;Register&lt;/a&gt;
                      &lt;/li&gt;
  
                      &lt;li class=&quot;nav-item&quot;&gt;
                          &lt;a class=&quot;nav-link btn btn-info&quot; style=&quot;margin: 5px;&quot; href=&quot;@Url.Action(&quot;Login&quot;,&quot;Home&quot;)&quot;&gt;Login&lt;/a&gt;
                      &lt;/li&gt;
                  &lt;/ul&gt;
              }
              &lt;form class=&quot;form-inline my-2 my-lg-0&quot;&gt;
                  &lt;input class=&quot;form-control mr-sm-2&quot; type=&quot;text&quot; placeholder=&quot;Search&quot;&gt;
                  &lt;button class=&quot;btn btn-secondary my-2 my-sm-0&quot; type=&quot;submit&quot;&gt;Search&lt;/button&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/nav&gt;
      &lt;div class=&quot;container body-content&quot;&gt;
          @RenderBody()
          &lt;hr /&gt;&lt;footer style=&quot;background-color:#e7f1f5;&quot;&gt;
              &lt;div class=&quot;row&quot; style=&quot;padding:10px;&quot;&gt;
                  &lt;div class=&quot;col-md-4&quot;&gt;
                      &lt;strong&gt;About Us&lt;/strong&gt;
                      &lt;p style=&quot;text-align: justify;&quot;&gt;
                          Get Instant Access To Every Discount, Deal, And Promo Code At Thousands Of Stores Online. Throw Out Your Coupon Clippings,
                          C4A Makes Sure You Get The Lowest Price, Every Time. World's #1 Coupon site. Automatic Coupon Codes. Save with Droplist.
                      &lt;/p&gt;
                  &lt;/div&gt;
  
                  &lt;div class=&quot;col-md-2&quot;&gt;
                      &lt;strong&gt;Know More&lt;/strong&gt;
                      &lt;p&gt;Terms &amp; Condition&lt;/p&gt;
                      &lt;p&gt;Privacy Policy&lt;/p&gt;
                      &lt;p&gt;Sitemap&lt;/p&gt;
                  &lt;/div&gt;
  
                  &lt;div class=&quot;col-md-4&quot;&gt;
                      &lt;strong&gt;Subscribe to our Mailing List!&lt;/strong&gt;
                      &lt;form class=&quot;shadow-lg p-4 mb-5 bg-white rounded&quot; id=&quot;formSub&quot;&gt;
                          &lt;input type=&quot;text&quot; name=&quot;Email&quot; id=&quot;Email&quot; placeholder=&quot;Email here..&quot; /&gt;
                          &lt;button id=&quot;click&quot;&gt;Subscribe&lt;/button&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
  
                  &lt;div class=&quot;col-md-2&quot;&gt;
                      &lt;strong&gt;Follow Us!&lt;/strong&gt;
                      &lt;p&gt;&lt;i class=&quot;fa fa-facebook-square&quot;&gt;&lt;/i&gt; &lt;i class=&quot;fa fa-twitter-square&quot;&gt;&lt;/i&gt; &lt;i class=&quot;fa fa-youtube-square&quot;&gt;&lt;/i&gt;&lt;/p&gt;
  
                  &lt;/div&gt;
  
  
  
              &lt;/div&gt;
              &lt;p&gt;&amp;copy; @DateTime.Now.Year - Created by RayZ&lt;/p&gt;
          &lt;/footer&gt;
      &lt;/div&gt;
  
      @Scripts.Render(&quot;~/bundles/jquery&quot;)
      @Scripts.Render(&quot;~/bundles/bootstrap&quot;)
      @RenderSection(&quot;scripts&quot;, required: false)
      @section Scripts{
  
          &lt;script src=&quot;~/Scripts/jquery-3.5.1.min.js&quot;&gt;&lt;/script&gt;
          &lt;script src=&quot;~/Scripts/jquery.validate.unobtrusive.min.js&quot;&gt;&lt;/script&gt;
          &lt;script&gt;
              $(document).ready(() =&gt; {
  
                  $('#click').click(onClick);
  
                  return false;
              });
  
              function onClick() {
  
                  alert(&quot;Working&quot;);
              }
          &lt;/script&gt;
      }
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  <p>How can I make this form submit to Action Controller, and return a Success message? Help is much appreciated.</p>