Is it possible to have an Ajax.ActionLink(...,...) to refresh the whole page instead of an UpdatetargetID?
I prefer using an Ajax.ActionLink because the classic Html.ActionLink is not a POST method.
I try:
@Ajax.ActionLink("Click me", "MyAction", "MyController", new { value = '1234' }, new AjaxOptions { HttpMethod = "POST", Confirm = "Are you sure ?" }, null)
But the page is not refreshed, I had to press F5.
Thanks.
You can actually combine the two methods proposed by gardarvalur to get MVC-like code that doesn't require wrapping the entire page in a div. Move window.location.reload() call to the OnSuccess property of the AjaxOptions object like this:
@Ajax.ActionLink("Click me", "MyAction", "MyController", new { value = '1234' }, new AjaxOptions { HttpMethod = "POST", OnSuccess="window.location.reload()" })
No jQuery involved, just some plain old javascript in an MVC Ajax ActionLink.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With