title: How to update div tag in Javascript with data from model for onsubmit form asp.net mvc
body: <p>In my page I have a form tag which submits to server, gets data and redirects to same page.
  The problem is the the div tag which has the data from server is not getting updated. How to do that in Javascript?</p>
  <pre><code>&lt;% using (Html.BeginForm(&quot;Addfile&quot;, &quot;uploadfile&quot;, FormMethod.Post, new
     {
         id = &quot;uploadform&quot;,
         enctype = &quot;multipart/form-data&quot;
        
     }))
         { %&gt;
  &lt;input type=&quot;file&quot; id=&quot;addedFile&quot; name=&quot;addedFile&quot; /&gt;&lt;br /&gt;
      &lt;input type=&quot;submit&quot; id=&quot;addfile&quot; value=&quot;Addfile&quot; /&gt;
      &lt;div id=&quot;MyGrid&quot;&gt;
    //data from the model(server side) filelist is not updating&lt;/div&gt;
  </code></pre>
  <p>What will be the form <code>onsubmit</code> Javascript function to update the div tag with the data from the model.</p>
  <p>My <code>uploadfile</code> controller get post methods are as:</p>
  <pre><code>[AcceptVerbs(HttpVerbs.Get)]
            public ActionResult Upload()
          {
              return View();
          }
   [AcceptVerbs(HttpVerbs.Post)]
          public ActionResult AddFile(HttpPostedFileBase addedFile)
          {
             static List&lt;string&gt; fileList = new List&lt;string&gt;();
             string filename = Path.GetFileName(addedFile.FileName);
              file.SaveAs(@&quot;D:\Upload\&quot; + filename);
              fileList.Add(filename);
              return(&quot;Upload&quot;,fileList);
  }
  </code></pre>