XML parsing of server response...
Hi,
I try to read data from an XML file called by ajax:
- function sendFrm(){
- $.ajax({
- type: "POST",
- url: "jqueryServer.asp",
- data: "firstName="+ obj('firstName'),
- dataType: "xml",
- success: readXML
- });
- }
Ithe server send me this XML:
- <?xml version='1.0' encoding='ISO-8859-1'?>
- <root>
- <vars>
- <firstName>MyName</firstName>
- </vars>
- </root>
So I read the XML in this way:
- function readXML(xml){
- $(xml).find('vars').each(function(){
- var f = $(this).find('firstName').text();
- alert(f);
- }); }
Why the alert shows as response "objectHTMLInputElement" instead of "
MyName
" ?
Thanks