我对Phonegap很陌生。我正在phonegap中做一个应用程序,在这里我想从特定的url获取数据。数据在xml文件中。任何人都可以通过提出一些想法来帮助我。
提前致谢...
html>
<head>
<title>Xml file read</title>
<script type="text/javascript">
function loadXMLDoc()
{
var request = new XMLHttpRequest();
request.open("GET","http://saletrack.cynere.net/test2.xml", true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200 || request.status == 0) {
return request.responseXML;
// do something with my xml
}
}
}
request.send();
}
</script>
</head>
<body>
<script type="text/javascript">
var xmlDoc=loadXMLDoc();
var x=xmlDoc.getElementsByTagName("author");
for (i=0;i<x.length;i++)
{
document.write(x[i].childNodes[0].nodeValue);
document.write("<br />");
}
</script>
</body>
</html>