I am using MVC5. I am loading images from a list using Unobtrusive Ajax.ActionLink(). Here is the sample code:-
<ul class="list-group list-unstyled lists">
@foreach (var item in Model)
{
<li>
@Ajax.ActionLink(@item.Name,
@item.Action,
"Home",
new {id = @item.Id },
new AjaxOptions
{
UpdateTargetId = "divImage",
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
OnSuccess = "enableZoom"
})
</li>
}
</ul>
OnSuccess callback I call a function 'enableZoom'. It works as long as it is within the script tag of the view page. But When I move enableZoom function to custom.js file, OnSuccess callback can't find or call it.
<script>
function enableZoom() {
$("#divImage").zoom({
on: "grab",
magnify: "1"
});
}
</script>
PS: My custom.js file is loading successfully (confirmed through firebug) and custom.js has other functionality too and that is working. Any clue/help would be appreciated?