0

我有一个简单的 jQuery Mobile 应用程序,它托管在一台服务器 (server1.com) 上,其中包括一些查询托管在另一台服务器 (server2.com) 上的数据库的 php 页面。

当所有东西(jQuery Mobile 网站和数据库)都托管在同一台服务器上时,这一切都很好,但是当它们分开时,它不会显示任何数据。我一直在查看配置默认值文档:

http://api.jquerymobile.com/global-config/

特别是 allowCrossDomainPages 选项。我创建了一个名为 custom-scripting.js 的新脚本文件,其中包含以下内容:

$(document).bind("mobileinit", function(){
  $.extend(  $.mobile , {
    allowCrossDomainPages: true
  });
});

并按照推荐调用它:

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="custom-scripting.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

但我的 PHP 页面仍然没有向 server2.com 发出请求。我希望设置 allowCrossDomainPages: true 将允许 PHP 页面向外部服务器发出请求。

还有其他人使用 jQuery Mobile 设置类似的配置,需要使用 php 从外部服务器检索数据吗?

4

0 回答 0