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