Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
36644 Points
5432 Posts
May 01, 2012 04:52 AM|LINK
ajax does not work for this becuase there is little you can do with the response data (downloaded file).
success: function(data) { ...
not much you can do with data. a better approach is a form post to a tarhget window:
<form action="@Url.Content("~/ExcelReport")" method="post" target="_blank" id="report"> <input type="hidden" name="__RequestVerificationToken" value="@token"/> <input type="hidden" name="content" /> <input type="hidden" name="fileName" value="export.xls"/> </form> <script> var frm = $('#report'): frm.find('name=[content]').val($('#grid-fixo').html()); frm.submit();
bruce (sqlwo...
All-Star
36644 Points
5432 Posts
Re: AttachFile with Ajax Post
May 01, 2012 04:52 AM|LINK
ajax does not work for this becuase there is little you can do with the response data (downloaded file).
success: function(data) { ...
not much you can do with data. a better approach is a form post to a tarhget window:
<form action="@Url.Content("~/ExcelReport")" method="post" target="_blank" id="report">
<input type="hidden" name="__RequestVerificationToken" value="@token"/>
<input type="hidden" name="content" />
<input type="hidden" name="fileName" value="export.xls"/>
</form>
<script>
var frm = $('#report'):
frm.find('name=[content]').val($('#grid-fixo').html());
frm.submit();