views:

15

answers:

2

Hi,

How one can reload the custom javascipt file after ajax call is completed.

In my case I have a custom javacript file to manipulate the views data and filters. It works perfectly first time.

But once the user sets filter and hit Apply i:e after ajax call the javascript loose its importance. Its their but not registering any event.

I read some articles on Drupal.org but didn't get some solid solution.

Note - Its not a module .js file but a custom stand alone .js file under the theme folder.

Thanks in Advance

Cj

A: 

To add a script you need to use document.createElement("script") you can't just set innerHTML. see http://www.phpied.com/javascript-include-ready-onload/ for a good example that deals with seperate browsers.

Wes
+2  A: 

You should read up on JavaScript in Drupal, especially any part about Drupal.bahaviors.

The main point is that you need to turn your custom JavaScript file into Drupal.behaviors, because those will get reattached to content loaded dynamically via AJAX like calls.

Henrik Opel