I have the following script which works as expected , it retrieves an XML list and assigns some variables
$.ajax({
    type: "POST",
    url: "pgGeneral_login/validate.php",
    data: { user:user , pass:pass },
    dataType: "xml",
    success:loginval      });  
function loginval(data){
    console.log("Returned" )
    valid = $(data).find('valid').text();   
    name = $(data).find('name').text();     
    pass = $(data).find('pass').text();
    }; 
What I would like to do is instead of assigning a variable to each of the xml results (valid = $(data).find('valid').text() ) is loop through the list an assign the value to the tag name without writing a huge list of code , if it was php I would use something like
    foreach ($row as $k => $v)
            $$k = $v 
any help please ?
 
     
     
     
    