View Full Version : reinitiate javascript after ajax call

Mar 14th, 2008, 08:59 AM

I'm having a problem with the site I'm writing.
I'm using PHP,MYSQL and JS/AJAX.
I'm using this code to add an RSS ticker (example 1)

The user of the website can add to a mysql table different RSS feeds and can choose which feeds to enable or disable.
if a user enables/disables an RSS feed, an AJAX call is made to a PHP script to read the RSS feeds that are enabled and will replace the original javascript code in the browser so that the newly enabled RSS feeds are added to the javascript. for each feed there will be a line like this.

cssfeed.addFeed("CSS Drive", "http://www.cssdrive.com/index.php/news/rss_2.0/") //Specify "label" plus
The code that I replace with the AJAX call, is the code of example1 in step 3 in the URL given above.

In Firefox/FireBug I checked that the code is correctly replaced. the ticker however keeps running with the old code and will not change until I reload the entire page which I prefer not to do.
I assume that I somehow need to do a call when the ajax call finished replacing the javascript code.
I'm using an Ajax call used in this example:
which allows me to issue javascript commands when the call to the PHP file is finished so I probably just need to issue the right command. I've been googleing for some time now but didn't find a sollution yet so any idea is appreciated.

if you need more info, let me know.

thanks in advance