Windows phone 7 对windows phone应用程序内页面的Ajax请求
我正在使用phonegap构建一个windows phone移动应用程序。我需要从应用程序中的特定页面获取一些内容…这是我目前拥有的内容:Windows phone 7 对windows phone应用程序内页面的Ajax请求,windows-phone-7,cordova,Windows Phone 7,Cordova,我正在使用phonegap构建一个windows phone移动应用程序。我需要从应用程序中的特定页面获取一些内容…这是我目前拥有的内容: function getXMLHTTPRequest() { try { req = new XMLHttpRequest(); } catch(err1) { try { req = new ActiveXObject('Msxml2.XMLHTTP'); } catch (err2) { try { req = new ActiveXObject('M
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
try {
req = new ActiveXObject('Msxml2.XMLHTTP');
} catch (err2) {
try {
req = new ActiveXObject('Microsoft.XMLHTTP');
} catch (err3) {
req = false;
}
}
}
return req;
}
var first_req = getXMLHTTPRequest();
var firsturl = '/books/Col.xml';
first_req.open('GET', firsturl, true);
first_req.onreadystatechange = createResponse;
first_req.send(null);
function createResponse()
{
if (first_req.readyState == 4) {
if(first_req.status == 200)
{
navigator.notification.alert(
'sucess',
doNot,
'success',
'Worked'
);
}
else {
navigator.notification.alert(
"request.status = "+first_req.status,
doNot,
'Error',
'Try Again'
);
}
它不工作,else块运行并发出警报请求。状态=0
非常感谢您的帮助您是否尝试过删除'/books/Col.xml'中的第一个/in'/books/Col.xml',因此“books/Col.xml'?是的,我尝试过,但仍然不起作用。www/books/Col.xml怎么样?您是否将您的图书文件夹放在了phonegap项目的www文件夹中?books/Col.xml应该是正确的url。至少这是我使用的路径类型,不同之处在于我加载json文件并使用jquery查询项目的www文件夹中的XHTPrequesties。。。