Parsing XML response
Parsing XML response
I am trying load an data as xml that i have generated through php,
data load with no errors but nothing happens am i parsing it wrong i
saw couple of tutorials online but nothing happened, if change the url
to "gatedate.xml" and put simple xml there everything works fine.
Please help on what i am doing wrong.
Thanks,
***************
Jquery Call
***************
$.ajax({
type: "POST",
url: "getdate.php",
data: 'gender=' + Usex + '&minage=' + Uminage + '&maxage=' +
Umaxage + '&zip=' + Uzip ,
dataType: "xml",
success: function(xml){
//This simple XPath XML function looks through the returned XML
data
//All tags can now be accessed within the loop
var _name = "";
//alert("test");
//This function will loop for each match on addresses/address
$("/myDates/myPeople", xml).each(function(){
var name_text = $("pname", this).text();
alert(name_text);
$('h2.date_name').html(name_text);
});
}
});
***************
XML DOC
***************
<?php
echo "<?xml version='1.0' encoding='utf-8'?>\n";
echo "<myDates>\n";
echo "<myPeople>\n";
echo "<pname>";
echo "Tamuir";
echo "</pname>\n";
echo "</myPeople>\n";
echo "</myDates>";
?>