title: Assigning JavaScript value to mvc model property
body: <p>I am using asp.net mvc application and trying to upload an image.</p>
  
  <p>This is uploading image function</p>
  
  <pre><code>$(document).ready(function () {
  
          TableDatatablesEditable.init();
          $("#UploadImg").change(function () {
              var data = new FormData();
              var files = $("#UploadImg").get(0).files;
              if (files.length &gt; 0) {
                  data.append("MyImages", files[0]);
              }
  
              $.ajax({
                  url: "@Url.Action("UploadFile")",
                  type: "POST",
                  processData: false,
                  contentType: false,
                  data: data,
                  success: function (response) {
                      $("#HeaderInput").text('/Upload/' + response);
  
                      $("#imgPreview").attr('src', '/Upload/' + response);
                  },
                  error: function (er) {
                      alert(er);
                  }
  
              });
          });
      });
  </code></pre>
  
  <p>Here i am displaying the uploaded image
    </p>
  
  <pre><code>                @Html.Label("Logo Upload", new { @class = "col-md-3 control-label" })
  
                  &lt;div class="col-md-7"&gt;
                      &lt;input type="file" class = "col-md-3 control-label" id="UploadImg" value="@Model.FundDetail.ImagePath" name="@Model.FundDetail.ImagePath" /&gt; &lt;br /&gt;&lt;br /&gt;                           
                      &lt;br /&gt;                   
                  &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>The image uploading is working fine but values are not assigning to the model's property <code>"@Model.FundDetail.ImagePath"</code></p>
  
  <p>How can i assign value from javascript. Can anyone suggest me how to do this.</p>
  
  <p>Thanks in advance</p>