如何解析与JavaScript / jQuery和PhoneGap的远程xml文件? [英] how to parse remote xml file with javascript/jQuery and phonegap?

查看:79
本文介绍了如何解析与JavaScript / jQuery和PhoneGap的远程xml文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关PhoneGap的开发:

For phonegap development:

  1. 是有可能获取远程数据phonegape?
  2. 是有可能使用获取远程JSON / xml文件的Ajax / jQuery的?
  3. XmlHtt prequest可以获取远程XML文件?

也是任何建议它还是重要的一环。

also any suggestion for it or important link.

推荐答案

Ajax的工作原理没有什么区别,它确实别的地方execept的跨域调用是确定与PhoneGap的,
<一href="http://stackoverflow.com/questions/6252312/how-to-parse-remote-xml-file-using-jquery-ajex-for-phonegap/6283358#6283358">see我其他的答案

Ajax works no different that it does else where execept that cross domain calls are ok with phonegap,
see my other answer

jQuery的AJAX调用示例@ http://api.jquery.com/jQuery.ajax/
解析XML与JavaScript @ http://www.w3schools.com/xml/xml_parser.asp

Example of jquery ajax call @ http://api.jquery.com/jQuery.ajax/
Parsing xml with javascript @ http://www.w3schools.com/xml/xml_parser.asp


$.ajax({
  url: "test.html",
  context: document.body,
  success: function(){
    $(this).addClass("done");
  }
});

原生javascript调用

参考从PhoneGap的关于Ajax
(见问题:

问:我想创造的PhoneGap通过AJAX访问外部部署的Web服务的应用程序。我该如何解决这个问题的XmlHtt prequest跨域安全策略?)

Example of native javascript call

Ref from phonegap about ajax
(see question:

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?)

真到这个网站生活中的例子

True to life example on this site

这应该足以让你开始。 让我知道如果您有任何其他问题。

This should be enough to get you started. Let me know if you have any other questions.

这篇关于如何解析与JavaScript / jQuery和PhoneGap的远程xml文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆