asp.net mvc ajax post - redirecttoaction not working -


i used following code in 1 of controller;

            if (request.isajaxrequest()) {             return redirecttoaction("previewandsendemail");         } 

i debugged , comes return line , redirect didn't occur. possible inside ajax.beginform ? here razor code;

    using(ajax.beginform( new ajaxoptions { loadingelementid = "loading" })) {       <b>choose e-mail template : </b>@html.dropdownlist("emailtemps")<br /><br />      <input type="submit" value="preview & send" />      <span id="loading" style="display: none;">         <img title="loading..." alt="load" src="@url.content("~/content/app_icons/gifs/loading.gif")"     </span>  } 

you can't redirect in ajax action server. if want browser redirect in ajax action need javascript. using ajax redirect absolutely useless. if intend redirect use normal html.begin form , don't bother ajax.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -