How would you rewrite this statement using Jquery + Ajax only? This code displays a link. When I click on it a view is returned into the StuffPanel id.
@{ AjaxOptions options = new AjaxOptions
{
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "StuffPanel",
OnBegin = "OnBeginWork",
OnComplete = "OnCompleteWork",
};}
<p>@Ajax.ActionLink("show stuff", "Index", "Stuff", options)</p>
Here you go:
I’d recommend you keep the actionLink as all it’s doing is getting the correct routing for you. Add an ID to it so that you can bind the click event easier, and then use the click event callback to fire the ajax call. Use the success function to replace the contents of
#StuffPanelwith the response.