Jquery loop through xml list and assign variables
<p>I have the following script which works as expected , it retrieves an XML list and assigns some variables</p>

<pre><code>$.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();


    }; 
</code></pre>

<p>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 </p>

<pre><code>    foreach ($row as $k =&gt; $v)
            $$k = $v 
</code></pre>

<p>any help please ?</p>
