Jump to content

Xillar

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Xillar's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, ( I'm dutch so my englisch is poor sorry :'( ) I've got a Ajax script with a for loop. I want to make a new request from inside the for loop with a created onclick as result i get this id 1 id 2 id 3 i give this id with my onlick as you can see in my code below. but if i click on the link in my result table te output in the next function handle_fact is always 3. my code: for loop: [code] for ( i=0;i<results.length; i++){                     var artId = result.getElementsByTagName("artId");           var artId = artId.item(i);           var artId = artId.firstChild.nodeValue                     var artTr = document.createElement("tr");                     var artaddTd = document.createElement("td");           artaddTd.className = "addTd";           artaddTd.innerHTML = artId;                     artaddTd.onclick = function()           {               make_request('mandje.php?id=' + artId, 'handle_fact', 'GET', null, true);           }                     artTr.appendChild(artaddTd);           artTbody.appendChild(artTr);           artTable.appendChild(artTbody);           artDiv.appendChild(artTable);           suggestionDiv.appendChild(artTable);                 } [/code] result code handle_fact: [code] function handle_fact(result) {     var productenDiv = document.getElementById("productenDiv");           var results = result.getElementsByTagName('result');     productenDiv.innerHTML = '';           for( ii=0; ii<results.length; ii++) {     var test= result.getElementsByTagName("test");     var test = test.item(ii);       productenDiv.innerHTML = test.firstChild.nodeValue;     }     } [/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.