我有一个使用jQuery移动的MVC3项目,我有一个小问题,当我将操作结果返回到视图时,jQuery移动不会重新加载页面,因此<head>中的<script>标记也不会被加载?
我在jQuery手机中重定向到另一个页面时遇到了同样的问题,可以通过将rel="external"添加到a标签来解决这个问题。
有没有什么办法可以强制页面在动作结果中重新加载?
谢谢,迈克
发布于 2012-06-10 23:32:43
在您的操作结果中尝试此操作。
window.location = 'your full path';发布于 2012-06-11 02:12:29
您可以手动更改页面并在options对象中设置此标志:
reloadPage (布尔值,默认值: false)强制重新加载页面,即使该页面已经位于页面容器的DOM中。仅当changePage()的'to‘参数为URL时使用。
来源:
示例:
<a data-role="button" href="/do-something.aspx">Click ME</a>
<script>
//bind to link elements for the click event
$('a').on('click', function () {
//manually change page to the clicked HREF
$.mobile.changePage(this.href, {
//set the reloadPage flag to true so jQuery Mobile will update the page
reloadPage : true
});
//stop the default behavior of the link
return false;
});
</script>默认情况下,移动版jQuery会首先查看当前的DOM是否存在所请求页面的某个版本,如果存在,则只会导航到该页面,而不会加载任何外部资源。
https://stackoverflow.com/questions/10969745
复制相似问题