Yes, the main page has content that does not change often so the page is cached to reduce hits on the DB. The secondary page called runs a query to get banner ads to be displayed on the main page. Once the query is ran I also create all the javascript necessary to display the ads. That is why I need to do this in Javascript so it will still run even on a cached page. The page is not regenerated dynamically but I need the ads to be able to do so - same content - new ads every time.
However I am not very fluent in AJAX and do not know how to get my generated code from the secondary page back to the inital page to show my new ads. You have the idea down - if you can provide code to achieve this I would be more then grateful! :-)
Main Topics
Browse All Topics





by: pratap_rPosted on 2008-06-02 at 09:21:14ID: 21693336
Not sure what you are trying to accomplish from your description. Let me see if I got it right
you need to include some javascript in your main page. The secondary javascript is dynamic or auto generated and you invoke this by calling a server page?
If I got it right then, you could use an iframe or AJAX to make a call to the server to retrieve the javascript/data to be included. Now if you have a javascript code just do an eval or append it to the current page's javascript collection