Hi, I have this XML
<lots of />
<?xml version="1.0" encoding="UTF-8"?>
<response><message>Sorry, username already taken</message></response>
(This gets returned from an $.Ajax call)
I try to get the value of the <message> node:
<script type="text/javascript">
$(document).ready(function(){
$("#register table").hide();
$("#registerTitle").click(function(){
$("#register table").slideDown('slow');
});
$("form[name='registerform']
input[name='username']").blur(function(){
var el = $("form[name='registerform'] input[name='username']")[0];
$.ajax({
url:"
http://lab.local/login.cfc", type:"get",
dataType:"xml",
data:"method=StrGetUsernameIsUnique&username="+el.value,
success:function showAlert(xml){
$("form[name='registerForm']
input[name='username']").removeClass("alertField");
if($(xml).find('message').text() != ""){
$("#registerMessage").value = $(xml).find('message').text();
$("form[name='registerForm']
input[name='username']").addClass("alertField");
}
}
});
});
});
</script>
</head>
But $(xml).find('message').text() does not contain the vaue of the
node. (I used the article at
http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.htmlas a guide.)
Does anybody know how to get a value of a XML node in JQuery?
Thanks!