asp.net MVC Partial Views how to initialise javascript

Posted by Simon G on Stack Overflow See other posts from Stack Overflow or by Simon G
Published on 2010-06-01T10:41:04Z Indexed on 2010/06/01 10:43 UTC
Read the original article Hit count: 381

Hi,

I have an edit form that uses an ajax form to submit to the controller. Depending on the data submitted I redirect the user to one of two pages (by returning a partial view). Both pages rely on javascript/jquery and neither use anything common between the pages.

What is the best way to initialise these javascripts on each page? I know there is the AjaxOption OnComplete but both pages are quite dynamic depending on the Model passed and I would rather keep the javascript for both pages seperate rather than having a common method.

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about asp.net-mvc