开发者

JQuery Mobile - is there a way to turn off AJAX for the whole page?

I am c开发者_Python百科onverting an existing ASP.NET website to use jQuery Mobile controls. The first thing I did was replace the Login.aspx with the new Masterpage and mobile controls. However, now after the login occurs, in the code-behind, there is a Response.Redirect to Default.aspx. When that occurs, a javascript error occurs and the whole page dumps and fails to load.

My assumption is that the mechnanism(s) in jQuery mobile that try to AJAX everything are not playing nicely with scripts that MS.NET is producing. So I want jQuery to ignore the redirect and not AJAXify it.

The problem is, all the solutions I see have to do with adding code to the anchor tag, but I'm redirecting from behind, not using an anchor tag.


Add the attribute data-ajax="false" to the <form> tag on the page. That way when the login form is submitted, jQuery Mobile won't try to update the page using AJAX.


If you are using jQuery mobile then you can use following code to disable ajax through the page.

<script>
   $.mobile.ajaxEnabled = false;
</script>


Refer the JQueryMobile documentation here

The easiest way would be to have this , ajaxFormsEnabled :false

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜