views:

49

answers:

2

I have some asp code where I need to execute some javascript function and then redirect the user to a new page. when i do this ibn my code, I am response writing the javascript to the browser. the issue that i am having is that the redirect occurs on ther server side, before the JS function finishes. Is there a work around for this? Thanks

+2  A: 

Do the redirect in javascript. At the end of your javascript function:

document.location.href = 'http://url-of-the-next-page';
captaintokyo
+1  A: 

I'm skeptical that there is a good reason to do it this way, but if you need to solve this problem I suggest you use JavaScript to do the redirection as well.

That's the only way...ASP is going to process the entire script and can't wait for any client side script to finish.

clifgriffin