0
Answer

asp.net mvc dialog box mechanics at the end of the request

kaunainbaig kaunainbaig

kaunainbaig kaunainbaig

14y
2.5k
1
<form action="/Home/JSONRequest" method="post" enctype="multipart/form-data" onsubmit="return submitForm(this)">

 
<input type="file" name="file" id="file" />
   
<input type="submit" name="submit" value="Submit" />


</form>

 
<script type="text/javascript">
 
function submitForm(frm) {
     
var tdata = $(frm).serialize();


      $
.ajax({
      url
: "/Home/JSONRequest",
      data
: tdata,

          success
: function(result) {




         
},
          type
: "POST",
          datatype
: "json"
     
});
 
}
 
</script>


    public ActionResult JSONRequest(FormCollection form)
    {

        string a = form["name"];
        HttpPostedFileBase upload = Request.Files["file"] as HttpPostedFileBase;
     var data = new { name = "aaaa", Success = "Record is Succesfully Saved"}

              return Json( data );  


    }

Can anybody tells me why there is a dialog box at the end of the flow of the code asking to save the file. what i could check ,what is going
wrong . This is really very frustating issue