I currently have an ASP.NET MVC app and on one page I have the following Ajax call:
$.ajax({
url: "/Home/GetAuthCode/",
type: "GET",
contentType: 'application/json',
success: function () {
}
});
This calls an ActionResult method in my ASP app:
public ActionResult GetAuthCode()
{
//Do Stuff
Return View();
}
I would like it to navigate to the view once the method has 'Done Stuff' however it doesnt return to the view but returns to the ajax call once completed.
How can I call the method from the webpage and allow it to redirect to the specified view as the ajax call does not seem to do it.
GetAuthCodeexists and try settingcontentType:html. Additionally you can setwindow.location.href = '/Home/GetAuthCode/'in your ajax success.