【发布时间】:2011-06-07 06:25:43
【问题描述】:
对于 phonegap 开发:
- 是否可以为 phonegape 获取远程数据?
- 是否可以使用 ajax/jquery 获取远程 json/xml 文件?
- XmlHttpRequest 可以获取远程 xml 文件吗?
还有任何建议或重要链接。
【问题讨论】:
标签: javascript jquery android ajax cordova
对于 phonegap 开发:
还有任何建议或重要链接。
【问题讨论】:
标签: javascript jquery android ajax cordova
Ajax 的工作方式与其他地方没有什么不同,除了可以使用 phonegap 进行跨域调用之外,
see my other answer
jquery ajax 调用示例@http://api.jquery.com/jQuery.ajax/
用javascript解析xml@http://www.w3schools.com/xml/xml_parser.asp
$.ajax({
url: "test.html",
context: document.body,
success: function(){
$(this).addClass("done");
}
});
Example of native javascript call
来自 phonegap 的关于 ajax 的参考
(见问题:
Q. I want to create an application for phonegap to access externally deployed web services via AJAX. How can i resolve the issue with the cross-domain security policy of XmlHttpRequest?)
本网站上的真实示例
这应该足以让你开始。 如果您还有其他问题,请告诉我。
【讨论】: