为什么在jQuery mobile的第二页中没有加载样式?

时间:2018-02-11 12:26:04

标签: jquery-mobile

以下是 mywebsite / index.php 的屏幕截图,这是一个没有jQuery Mobile(JQM)的PC网站,包含所有脚本和样式。

enter image description here

mywebsite / mobile / options.php 的屏幕截图下方,该页面设计为在移动浏览器上运行,具有JQM。

enter image description here

以下是退出按钮的HTML脚本,实际上是ahchor代码:

<a href="../logout.php" data-role="button" data-mini="true" data-icon="delete" data-inline="true" data-ajax="false">Logout</a>

..指的是移动文件夹中的主mywebsite文件夹。

当我点按/点击退出时,应该转到PC站点 mywebsite / index.php 。以下是显示的内容:

enter image description here

如果我使用alert(document.location);显示位置,则会显示 - mywebsite / mobile / options.php

我必须按 F5 才能按原样查看页面。

我知道这种情况正在发生,因为JQM加载了AJAXually页面,因此忽略了BODY标记之外的所有脚本和样式表。我知道这个问题与StackOverflow中的许多问题重复,我已经尽力找到解决方案,但找不到解决方案。

如何在不需要刷新的情况下移动到index.php?

1 个答案:

答案 0 :(得分:1)

您需要在logout.php文件中添加其他代码,以便在执行注销代码后执行。 PHP标头可以实现这一点。在PHP标记中,将其添加到代码的末尾:

标题(&#39;位置:http://mywebsite/index.php&#39;);