• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[JS] jquery get problem

Skilled Illusionist
Joined
Oct 28, 2008
Messages
379
Reaction score
47
hello,
i've got a little problem
Code:
var divs;
var id;
var counter1;
function loadTags(){
    divs = document.body.getElementsByTagName('div');
    counter1 = 0;
    for(counter1 = 0;counter1 <= divs.length; counter1++){
        id = divs[counter1].id;
        $.get("./common.php", {getTags: id}, function (data){
            divs[counter1].innerHTML += data;

        });
    }
}
The succes function of the $.get (jquery)request wont take over the variable counter1. I don't know why, i've tried alot but can't seem to find the problem...
 
Joined
Sep 10, 2006
Messages
2,817
Reaction score
1,417
I had a feeling they do, considering you pass the id directly to get and unless your primary keys(are you getting that text from db, right) are varchars, which I think is not even possible, it would make sense they are numbers.

Either way, did my code work? o_O
 
Skilled Illusionist
Joined
Oct 28, 2008
Messages
379
Reaction score
47
Well with my code if i changed the variable counter1 in the succes function it worked, yours just did nothing ....
 
Back
Top