I'm unable to redirect to my Get method after the Post method in the same controller as shown below..
My javascript code which initiates Post call..
$.ajax("home/myquery", {
/*data: JSON.stringify(tmp1),*/
data: JSON.stringify({id:tmp1}),
type: "post", contentType: "application/json",
success: function (result) { window.location.replace(window.location.host + '/MyController/MyReport/'+ result); },
error: function (result) { alert("Error Saving") }
});
My method in asp.net mvc controller which accesses the call..
[HttpPost]
public ActionResult MyQuery(string id)
{
//do some work here
return return this.Content("abc");
}
The method to which it needs to redirect..
[HttpGet]
public ActionResult MyReport(string model)
{
return View();
}
Any help is sincerely appreciated.
Thanks
window.location.href = '@Url.Action("MyReport","MyController")?model='+ result;