data-ajax="false" 是什么意思?真的吗? [英] What does data-ajax="false" really do?
问题描述
我网站上的链接不起作用,我得到了在我的锚点上使用 data-ajax="false"
的解决方案,但没有得到真正的解释.有人可以帮我吗?
The links on my site don't work and I got an solution of using data-ajax="false"
on my anchors without getting a true explanation. Can someone help me?
推荐答案
data-ajax
是 jQuery Mobile 的一个特性.默认情况下,JQM 将尝试通过 ajax 加载页面以改善用户体验和转换.如果您设置 data-ajax='false'
,则 JQM 将执行普通页面请求,而不是使用 ajax.这可用于表单和链接.
data-ajax
is a feature of jQuery Mobile. JQM by default will try to load pages via ajax for improved user experience and transitions. If you set data-ajax='false'
then JQM will do a normal page request instead of using ajax. This can be used on forms as well as links.
来自文档:
这告诉框架重新加载整个页面以清除 URL 中的 Ajax 哈希
This tells the framework to do a full page reload to clear out the Ajax hash in the URL
如果您想在所有链接上禁用 ajax,那么您可以这样做:
If you want to disable ajax on all of your links then instead of adding data-ajax
to everything, you can do it like this:
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
});
这篇关于data-ajax="false" 是什么意思?真的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!