One thing I have been struggling with is AJAX applications is managing
the js code that powers them.

For example if you have a page that loads content from an AJAX call to
the server and that content also has js code associated with it in
order to function how do I manage that code? If I have 20 pages that
get loaded from the server via AJAX at one point or another I do not
want to have one huge js file with a bunch of code for each page in
it.

I was wondering if it's better to embed the js for each page loaded
via AJAX or call it separately? Normally when I need chunks of HTML &
js, like a data grid for example; that get loaded in via AJAX call I
do not have this called code in the traditional HTML doc, in other
words the HTML being loaded has no HTML head, body etc.. it's just
HTML generated by the server and injected into a section of the
calling page. So in this situation should I load the script that is
required by the HTML via the success callback?

Another delima is communicating events and such between chunks of
loaded HTML/js, like if I have a Tabs widget and an accordion on the
same page and each have content loaded via AJAX and the content in tab
1 needs to bind and interact with events in a section of the accordion
content loaded via AJAX.

Reply via email to