Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery mobile与ASP.NET的组合问题_Javascript_Asp.net_Jquery_Jquery Mobile - Fatal编程技术网

Javascript jQuery mobile与ASP.NET的组合问题

Javascript jQuery mobile与ASP.NET的组合问题,javascript,asp.net,jquery,jquery-mobile,Javascript,Asp.net,Jquery,Jquery Mobile,我正在开发一个结合jQuery.mobile和 asp.net webforms 为了使asp.net控件的回发正常工作,我必须在 页面顶部,如下所示: <script> $.mobile.ajaxEnabled = false; </script> $(document).bind("mobileinit", function () { $.mobile.ajaxEnabled = false; }); <script src=

我正在开发一个结合jQuery.mobile和 asp.net webforms

为了使asp.net控件的回发正常工作,我必须在 页面顶部,如下所示:

   <script>
      $.mobile.ajaxEnabled = false;
   </script>
$(document).bind("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
});
<script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js"></script>      
<script>
        $(document).bind("mobileinit", function () {
            $.mobile.ajaxEnabled = false;
        });    
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>  
这只会导致弹出窗口在不到一秒钟内显示, 然后它消失了。当我注册clientscript时也是如此 从codebehind在服务器端按钮按下时触发弹出窗口 单击后,弹出窗口将闪烁,然后消失。 但是当我在页面顶部禁用ajax时,弹出窗口 打电话很好


有没有办法绕过这些问题

文档就绪无法与jQuery Mobile一起成功使用。它通常会在页面
DOM
填充之前触发

而不是这一行:

$(document).ready(function () {        
    $('#myPopup').popup('open'); 
});
$(document).on('pagebeforeshow', '#page-id', function(){       
    $('#myPopup').popup('open'); 
});
使用此行:

$(document).ready(function () {        
    $('#myPopup').popup('open'); 
});
$(document).on('pagebeforeshow', '#page-id', function(){       
    $('#myPopup').popup('open'); 
});
其中,
#页面id
是包含该弹出窗口的页面id

jQuery Mobile在document ready方面存在问题,因此其开发人员创建了页面evenets来解决此问题,请在此中阅读更多关于此问题的信息,或查找

编辑:

我认为你的问题也在
$中。mobile.ajaxEnabled=false处理

该代码样本必须由如下事件触发:

   <script>
      $.mobile.ajaxEnabled = false;
   </script>
$(document).bind("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
});
<script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js"></script>      
<script>
        $(document).bind("mobileinit", function () {
            $.mobile.ajaxEnabled = false;
        });    
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>  
还有一件事,
mobileinit
事件必须在初始化
jQuery Mobile
之前触发,如下所示:

   <script>
      $.mobile.ajaxEnabled = false;
   </script>
$(document).bind("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
});
<script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js"></script>      
<script>
        $(document).bind("mobileinit", function () {
            $.mobile.ajaxEnabled = false;
        });    
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>  

$(文档).bind(“mobileinit”,函数(){
$.mobile.ajaxEnabled=false;
});    
我做到了

不要使用 说明

只需打开jquery.mobile-1.3.1.min.js文件 好的,我支持!0并将其更改为:ajaxEnabled:!一,


现在按CTRL+F5键,在项目继续进行的过程中为项目添加乐趣!;)

你好-谢谢你的回复。我试图更改为“pagebeforeshow”,但只有在设置$.mobile.ajaxEnabled=true时,它仍然有效;让我们一步一步来。您是否在mobileinit事件中禁用了ajax?不能像这样禁用Ajax:$.mobile.ajaxEnabled=false;嗨,我越来越近了,但还没到那里。在JQM中,这是一种奇怪的工作流。我现在有:$(document.on('pageinit',function(){$.mobile.ajaxEnabled=false;});然后在我的codebehind中出现一个按钮事件:Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),“popup”,“$(document).on('pagebeforeshow','#mobile_Page',function(){$('#alert')。popup('open'););;”,True)Response.Write(“test”)问题是调用popup后的任何代码都不会执行。所以在本例中,Response.Write(“test”)没有执行。您好,现在它终于可以工作了。但是,在引用标准jQuery.js文件之前,我必须先用ajax禁用事件初始化mobileinit代码块,然后它才能工作。隐马尔可夫模型。。我想我必须输入你关于JQM页面life cyclus的链接才能理解…谢谢你的帮助,Gajotres!