jquery - How to redirect from an action called on ajax -
i need redirect "home" action "login" action. "login" action called on ajax. what's happening "login" action redirecting "home" action. but, "login" action called on ajax, ajax success callback executing. instead want direct redirect login action home action. there way achieve in "login" action itself?
is "redirecting success callback" way of redirecting? have several conditions based on need redirect different views. great, if can redirect action itself
you can redirect home action ajax success callback shown :
window.location.href = '@url.action("home","controllername")'
write above code inside ajax success callback.
edit :-
you can use redirecttoaction()
when perform normal form submit here doing ajax call have try code shown in answer,if want test conditions before redirecting send conditions action ajax request json , check conditions in ajax callback , redirect appropriate controller action.
Comments
Post a Comment