ho provato con questo codice che poi è
uguale al tuo
Codice PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="../jquery-1.2.3.js"></script>
<script type="text/javascript">
$(function() {
$('#submitButton').click(function() {
var query = $("#query").val();
$.ajax({
type: 'POST',
url: 'test.xml',
data: 'q=' + query + '&p=1&rpp=10',
dataType: 'xml',
error: function(request, type) {
$('#filling').html(request.responseText);
alert(type);
},
success: function(xml) {
$(xml).find('label').each(function(){
var name_text = $(this).find('name').text();
$('#filling').append(name_text + "
");
});
}
});
});
});
</script>
</head>
<body>
<input type="text" id="query">
<input type="submit" value="cerca" id="submitButton">
<div id="filling"></div>
</body>
</html>
e con questo xml (perchè non usi utf-8 ?)
Codice PHP:
<?xml version="1.0" encoding="iso-8859-1"?>
<labels>
<label>
<name>EzraPound1</name>
<address>
<street>45UsuraPlace</street>
<city>Hailey</city>
<province>ID</province>
</address>
</label>
<label>
<name>EzraPound2</name>
<address>
<street>45UsuraPlace</street>
<city>Hailey</city>
<province>ID</province>
</address>
</label>
<label>
<name>EzraPound3</name>
<address>
<street>45UsuraPlace</street>
<city>Hailey</city>
<province>ID</province>
</address>
</label>
</labels>
e funziona quindi l'errore è altrove.
Togli il tag root in questo caso la root è labels