【问题标题】:how to parse remote xml file with javascript/jQuery and phonegap?如何使用 javascript/jQuery 和 phonegap 解析远程 xml 文件?
【发布时间】:2011-06-07 06:25:43
【问题描述】:

对于 phonegap 开发:

  1. 是否可以为 phonegape 获取远程数据?
  2. 是否可以使用 ajax/jquery 获取远程 json/xml 文件?
  3. XmlHttpRequest 可以获取远程 xml 文件吗?

还有任何建议或重要链接。

【问题讨论】:

    标签: javascript jquery android ajax cordova


    【解决方案1】:

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

    本网站上的真实示例

    这应该足以让你开始。 如果您还有其他问题,请告诉我。

    【讨论】:

    • 非常感谢所有信息链接和示例,现在我清楚了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-09
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-21
    • 1970-01-01
    相关资源
    最近更新 更多