I have a php file which creates an xml list , when viewed in a browser looks like this
<results>
<login>
<name>Mick Smith</name>
<pass>Micks Password</pass>
</login>
<login>
<name>John Brown</name>
<pass>Johns Password</pass>
</login>
</results>
I am trying to learn ajax with Jquery and have the following script , the problem is I was expecting the colsole log to display my results , but it returns nothing except the 'returned' . I have added DATA to the ajax statement as eventually I want to pass data to the file that creates the xml , I am really stuck with this can you offer any pointers please ?
$.ajax({
type: "POST",
url: "pgGeneral_login/validate.php",
data: { user:user, pass:pass },
dataType: "xml",
success: loginval() });
function loginval(data){
console.log("Returned")
$(data).find('login').each(function(){
name = $(this).find('name').text();
pass = $(this).find('pass').text();
console.log("Name :" + name)
console.log("Pass :" + pass)
}); // find loop
}