views:

29

answers:

2

I implemented filter, which should redirect me to one page if some conditions aren't true, But this filter don't work with Ajax Requests, after redirect, javascript capture result and put whole View into html element.

How can i Stop processing ajax request and redirect it to normal http request??

Thx in advance,

+1  A: 

Afaik, you can't do it server side. You can use something like

window.location.href = 'MyController/MyAction/params';

to redirect in your javascript function which processes the response.

fearofawhackplanet
+1  A: 

1) Wrote function in Javascript which do redirect:

ClientRedirect(url)
{
   document.location = url;
}

2) return javascript code, something like:

<script>ClientRedirect("path to desired action");</script>

It will get executed and will perform redirect

Sergey Osypchuk
When i'm inserting it into div it's not executing? Am i doing anything wrong?Controller returns this code and nothing happened.
Simon

related questions