View Full Version : Dynamic Ajax Content (loadjobs bug?)

03-10-2012, 11:34 PM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:
Im trying to use loadjobs to insert a css that hides a div

when i click home again i load a css that "shows" again the div

it works great, the first to times, after i can show or hide the div =(.

03-10-2012, 11:56 PM
Sorry for this post, i solve it using this script

<script type="text/javascript">








03-11-2012, 12:07 AM
No need to apologize. Your solution is a good approach. The loadobjs function only loads things once. It makes a list of the external css and javascript files it loads. Once one is on that list, it isn't loaded again.

03-11-2012, 06:49 AM
Oh I see, it would be great that it load the css or the script everytime,

in my case, i load a script to run AJAX Tabs script, i load the tabs using DYNAMIC AJAX CONTENT, its a mix where i use for the principal menu, the ajax content, and for the content i use the tabs..

So the tabs just works the first time the page is loaded or imported, or called, then if i call it again it wont work, and now i know why

how can i disable this list :P jajaja

03-11-2012, 11:50 AM
I don't think you want to. If you're loading javascript with loadobjs, you would eventually get a situation where you have tons of possibly conflicting javascript scripts in the head of the page, if you're loading css files, a similar thing could happen.

And I've noticed because I actually tried this once that at least in the case of stylesheets, IE has a limit as to the number of stylesheets one can jam into the page via appending them to the head. But that was with on page stylesheets, as opposed to stylesheet <link> tags.

So you can try it. In the loadobjs function, comment out this line as shown:

function loadobjs(){
if (!document.getElementById)
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref.setAttribute("src", file);
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
if (fileref!=""){
//loadedobjects+=file+" " //Remember this object as being already added to page

But since you're using jQuery, I'd be inclined to scrap both DD AJAX scripts and instead use jQuery AJAX functions. At the very least, use something like so for loading in external sheets (untested - modeled after the solution I used):

function addOrReplaceSheet(href){
var $ = jQuery, title="addedorreplaced", oldSheet = $('link[title="' + title + '"]'),
newSheet = $('<link rel="stylesheet" type="text/css">').attr({href: href, title: title});
} else {

03-11-2012, 04:37 PM
I try them, but with no succes.

I think that i didnt place second solution in the rigth place. for the first solutions it seems that is not working.

Is there any way to load or run:

var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
countries.setselectedClassTarget("link") //"link" or "linkparent"

When Dynamic Ajax content is loading an html. ?

i think thats the problem i was trying to insert that on a js file, and running a loadjob but, maybe it wont work that way. :D

thanks very very very much