Click here to Skip to main content
15,896,493 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to call jquery after function when mvc action file return..

What I have tried:

i want to call jquery after function when mvc action file return..


like this
$("[data-ajax-update*='partial']").after(function () {}
Posted
Updated 14-May-18 3:36am

1 solution

You can't because a request can only have one response, if you want a file to be downloaded then the response has to be the file, if you want javascript to execute then the response has to be html\javascript. The response can't be both of those things.

If you google for how to run javascript on file download you'll find various tricks and hacks to get this kind-of working, such as having a 1 pixel hidden iframe on the page that you use to do the file download so you can then run some javascript.

Also just to be clear there is no way of executing js after the file has been downloaded, the client has no idea if the file has been downloaded at all.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900