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
Post a Comment