Generating unobtrusive JS

Posted by nico on Stack Overflow See other posts from Stack Overflow or by nico
Published on 2010-06-10T06:32:45Z Indexed on 2010/06/10 6:42 UTC
Read the original article Hit count: 340

I have read quite a bit about unobtrusive JS and how to generate it and all that jazz...

My problem is this: I have a website that heavily relies on mod_rewrite, so essentially all the pages requests are sent to index.php that generates the main structure of the page and then includes the appropriate page. Now, there are different sections in the site and each section uses different Javascript functions (e.g. for different AJAX requests).

Now, if I just were to attach a function to the onload of the page obviously the thing would not work, as I do not have to initialise the same things for each page... so what is the best way to handle this situation?

I hope the situation is clear, I'll be happy to clarify if needed

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about unobtrusive-javascript