jquery - AJAX response for file download is in encoded format. -
jquery - AJAX response for file download is in encoded format. -
i create ajax phone call as
var formdata = new formdata(); formdata.append('name', 'john'); formdata.append('company', 'abc'); $.ajax({ url: url, data: formdata, processdata: false, contenttype: false, success: function(data){ window.location.href = data.url; // info not have url attribute. }, error: function(err){} });
here, should ideally excel file download response.
however,
success: function(data){ }
here data
contains bunch of encoded values can see in browser console. how can download url here.
ajax meant used sending/retrieving data, info in success function.
you should create post ordinary form , create sure server setting right header.
<form method="post" action="/path/to/excel/file"> ... </form>
after form create post, , server supply info , header if browser not back upwards viewing of excel files download start.
jquery ajax excel
Comments
Post a Comment