title: How to pass model from view to controller when click button in MVC?
body: <p><strong>Index - View</strong></p>
  
  <pre><code>@model SendAFaxWeb.Models.Send
  //view start here
  &lt;body&gt;
      &lt;div&gt;
          &lt;h2&gt;Test Upload File&lt;/h2&gt;
          &lt;form action="@Url.Action("Index", "Home")" id="form" method="post" enctype="multipart/form-data"&gt;
              @Html.AntiForgeryToken()
              &lt;div class="form-group"&gt;
                  &lt;label&gt;Fax Number:&lt;/label&gt;
                  @Html.TextBoxFor(m =&gt; m.Recipients[0].Number)
               &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;label&gt;Select File:&lt;/label&gt;
                  &lt;input type="file" name="files" id="file" multiple="multiple" onchange="this.form.submit();" /&gt;
              &lt;/div&gt;
  
              &lt;div&gt;
                @if (Model != null)
                   {
                     foreach (var item in Model.Documents)
                      {
                         &lt;li&gt;FileName: @item.Name&lt;/li&gt;
                      }
                    }
               &lt;/div&gt;
      &lt;/form&gt;
  
      &lt;input type="submit" name="send" value="Send" id="btnSend" /&gt;
  
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>Javascript- the javascript doesnt work</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
       $("#btnSend").click(function () {
          alert("button click");
          e.preventDefault();
  
          var model = @Html.Raw(Json.Encode(Model))
          $.ajax({
              type: 'post',
              url: '@Url.Action("Send", "Home")',
              data: JSON.stringify({ contact: model }),
              contentType: 'application/json; charset=utf-8',
              dataType: "json",
              success: function (data) {
                  alert(data);
              }
          });
          });
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public ActionResult Send(Send contact)
  {
      //some code here
  }
  </code></pre>
  
  <blockquote>
    <p>I tried to pass model by using javascript to the controller, but its
    not working. The alert in javascript also not popup. Can any one tell
    me what wrong with the code.</p>
  </blockquote>