I'm trying to render partial view with Ajax to fill the <div id="AjaxDiv"></div>
element. I'm able to achieve this with jQuery:
<input id="btnCompetitors" type="button" value="Get Competitors" />
<script>
function loadCategoriesPartialView() {
$('#AjaxDiv').load(@Url.Action("CategoriesPartial", "Dashboard"));
}
</script>
but I cannot get it to work with Ajax.ActionLink, which I would prefer.
@Ajax.ActionLink("Categories", "CategoriesPartial", "Dashboard", new AjaxOptions()
{
UpdateTargetId = "AjaxDiv",
InsertionMode = InsertionMode.Replace
})
What is missing? I tried various additional AjaxOptions, like calling the same method with OnSuccess etc., but I cannot do it properly. Bundles work fine for jquery (basically jquery + unobtrusiveAjax), so hopefully the same ones should work for the Ajax helper.