andyJ
andyJ

Reputation: 1080

ASP.NET MVC Ajax.ActionLink

When i click on a Ajax.ActionLink, which displays a partial view, why does none of the javascritp associated with the partial view fire? This previously all worked before when I used Html.ActionLink. I have a series of scripts referenced in master page, which include $document.Ready functions. I have also tried added the script into the partial views themselves but they still don't fire. Any ideas?

Upvotes: 2

Views: 797

Answers (1)

ArjanW
ArjanW

Reputation: 443

javascript code dynamicly loaded into a div doesnt get recognised as executable code.

put the code in a function in a sepperate .js file, load this in your site.master and start executing by adding the

new AjaxOptions { oncomplete="myJavascriptFunction" } 

to your Ajax.Actionlink

Upvotes: 2

Related Questions