I need help from you Javascript / Ajax gurus.
I have a page with a series of links. When a link is clicked a colorbox window opens and the content from the link is displayed in the window via Ajax. This works fine.
The problem I am having is that when I try to load content that includes a script tag, the script tag is not output at all. My understanding is that when content is loaded via Ajax any script tags should be removed from the content and output after the rest of the HTML . For some reason my script tag is not being readded.
I have tested the code in the script tag to make sure it works and it does so I am confident that is not the problem.
Any ideas?
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 100 000 and 250 000 dollars
- Won a Competition
Well, here’s what you could do: Instead of sending the tags to the client, you could instead send the URLs of such scripts. After you receive the URLs in the AJAX response, you can create an array with those URLs.
You can then pass the array of script urls to head.js. The scripts can be loaded either synchronously or asynchronously (in parallel, but execute in order), your call.
Also, you can run a callback after all the scripts have been loaded, maybe the initialization code that should be run after all the scripts are loaded. If you’re including such initialization code in one of the scripts, there is no need to do so, since the scripts are executed after they are loaded into the DOM .
Hope it helps
