7 Replies Latest reply on Dec 4, 2012 1:44 AM by Lockinski57

    Assigning variables with a for loop


      Hi All


      I am loading variables for a quiz from xml using Ajax:



      type: "GET",

      url: "loadVars.xml",

      dataType: "xml",

      success: function(xml) {


      The data I am getting is this:


        word1= $(xml).find('word1').text();

                          word1distracter1 = $(xml).find('word1distracter1').text();

                          word1distracter2 = $(xml).find('word1distracter2').text();

                          word1distracter3 = $(xml).find('word1distracter3').text();



      There are about 20 words and I want to use a for loop to assign variables on both sides of the equation.


      for (var i = 1; i < 20; i++){


      What is the syntax now? I've tried:





      Any help much appreciated.