Jquery getting information from xml issue

Jquery getting information from xml issue

Before i submit my problem just to let you know i've been using jquery and javascripting for about a month or 2 now so i appologise in advance if this is something stupid.

Basicaly I have created a form with "<select><option></option></select>" using jquery/javascript.

My main issue is that i want this to select from a database so i found out that you can get information from php files i just couldn't figure out how to get the variables it submits. I then found out that i can use xml to get the information to the script. but the code i have written doesn't seem to display anything. The code in red is what i think the issue is.
  1. //Default rows is 0
  2.         var Count = 0;
  3.        
  4.         //Get Id for form location
  5.         Location=document.getElementById('Login');
  6.         //Create form
  7.         Form=document.createElement("form");
  8.         //Create Select
  9.         Select=document.createElement("select");
  10.        
  11.         //Set default data to NULL       
  12.         var data = "";
  13.         //Get information from test.php
  14.         $.get('test.php', function(theXML) {
  15.             $('client',theXML).each(function(i){
  16.                 //Grab total amount of rows from xmlTag row
  17.                 var Count=$(this).find("Row").text();
  18.                 //Duplicate options using the fallowing
  19.                 for(i=0; i<Count; i++) {
  20.                     //Create option element
  21.                     Option=document.createElement("option");
  22.                    
  23.                     //Get Name for option
  24.                     Name=$(this).find("Name").text();
  25.                    
  26.                     //Grab Customers Id for Value
  27.                     Id=$(this).find("Id").text();
  28.                    
  29.                     //Create Text node using Name
  30.                     Text=document.createTextNode(Name);
  31.                    
  32.                     //Assign Text to Option
  33.                     Option.appendChild(Text);
  34.                    
  35.                     //Set Value as Id
  36.                     $(Option).attr('value', Id);
  37.                     //Assign option to Select Element
  38.                     Select.appendChild(Option);
  39.                 }
  40.                
  41.             });
  42.            
  43.         });
  44.        
  45.         Location.appendChild(Form);
  46.         Form.appendChild(Select);   
Before doing the above I checked to see if it would work so i done the fallowing script.

  1.         //Default rows is 0
  2.         var Count = 2;
  3.        
  4.         //Duplicate options using the fallowing
  5.         for(i=0; i<Count; i++) {
  6.             //Create option element
  7.             Option=document.createElement("option");
  8.                    
  9.             //Create Text node using Name
  10.             Text=document.createTextNode('Name');
  11.                    
  12.             //Assign Text to Option
  13.             Option.appendChild(Text);
  14.                    
  15.             //Set Value as Id
  16.             $(Option).attr('value', 'Id');
  17.             //Assign option to Select Element
  18.             Select.appendChild(Option);
  19.         }
  20.        
  21.         Location.appendChild(Form);
  22.         Form.appendChild(Select);   

And it worked so am sure the issue revolves around grabbing the information from the php file

this is how the information looks in the php file after php has extracted it from mysql and submited it.

  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <client>
  3.     <count>
  4.         <Row>2</Row>
  5.     </count>
  6.    
  7.     <person>
  8.         <Id>1</Id>
  9.         <Name>Steve</Name>
  10.     </person>
  11.    
  12.     <person>
  13.         <Id>2</Id>
  14.         <Name>Bill</Name>
  15.     </person>
  16. </people>
I also tried just using an XML file with the above information and this did not work either.

Am just not sure as to how i could get the the fallowing information from the mysql database to the script "`Id`, `Name` Count(total amount of customers)".

Thanks in advance for any help or sugestion provided...

p.s i may not fully understand certain aspects of javascripting or jquery so please show patients if i ask you to dumb things down abit. thank you