gendruwo schrieb:
All,
if i have an xml file like this
<Records>
<Record>
<Field id="1" name="Name" value="My Full name">
</Field>
<Field id="2" name="Address" value="My Address">
</Field>
<Field id="3" name="Telephone" value="12345678">
</Field>
<Field id="4" name="Age" value="27">
</Field>
<Field id="5" name="Occupation" value="Theft">
</Field>
</Record>
and i wanted to extract out the value for each name in the field, how
can i do it?
$("Field").attr(value)
Hi,
supposing you get the XML via a POST-Request you could do it like this:
$.post('myurl.php', {'param1':'value1'}, function(response) {
console.log($('Field', response).attr('value'));
});
Or you could try this:
$.post('myurl.php', {'param1':'value1'}, function(response) {
$('Field', response).each(function(){
alert($(this).attr('value'));
});
});
untested as always.
-- Marc