我有一个MVC3项目使用jQuery Mobile和我有一个小问题,当我将一个行动结果返回到一个视图,jQuery Mobile不重新加载页面,因此<head>
内的<script>
标签没有被加载?MVC ActionResult强制JQuery Mobile刷新页面?
我在重定向到jQuery Mobile中的另一个页面时遇到了同样的问题,并且可以通过将rel="external"
添加到标记来解决此问题。
是否有反正我可以强制页面重新加载的行动结果内?
谢谢, 迈克
我有一个MVC3项目使用jQuery Mobile和我有一个小问题,当我将一个行动结果返回到一个视图,jQuery Mobile不重新加载页面,因此<head>
内的<script>
标签没有被加载?MVC ActionResult强制JQuery Mobile刷新页面?
我在重定向到jQuery Mobile中的另一个页面时遇到了同样的问题,并且可以通过将rel="external"
添加到标记来解决此问题。
是否有反正我可以强制页面重新加载的行动结果内?
谢谢, 迈克
试试这个在动作的结果..
window.location = 'your full path';
您可以手动更改页面,并在options
对象设置此标志:
reloadPage(布尔型,默认值:false)强制重新加载页面,即使是012如果它已经在页面容器的DOM中,则返回。仅当changePage()的 'to'参数是URL时才使用。
来源:http://jquerymobile.com/demos/1.1.0/docs/api/methods.html
例子:
<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 Mobile的外观首先在当前的DOM,看是否请求的页面的版本存在,如果这样做,jQuery的移动版仅导航到该页面,而不会加载更多的外部资产。