asp.net-mvc – ajax链接被误处理
我有一个带有
jquery-mobile app的asp.net mvc 4.
在一个页面(url:/ StatementBatch)上,我有一个批次列表,它们只是批次详细信息页面的链接(url:/ StetementBatch / Details / 4). <li> <a href="/StatementBatch/Details/4"> <h3>January 2012</h3> <div style="float: right; width: 30%;"><strong>Issued : </strong>1/10/2012 12:00:00 AM</div> <div style="float: right; width: 30%;">Completed</div> <p class="ui-li-aside"><strong>1277</strong></p> </a> </li> 奇怪的是,一旦点击链接,并且细节页面呈现,浏览器当前网址现在是http:// localhost:49457 / StatementBatch#/ StatementBatch / Details / 4 我需要在应用中更改以修复此行为? 我的猜测是它的某种类似ajax加载相关的问题,但我的共享_Layout.cshtml文件包含$.mobile.ajaxEnabled = false;,我预计它会杀死所有ajax加载,但我显然错误地解释了那个. 谢谢! 解决方法
我怀疑这可能就是答案
jQuery Mobile ajaxEnabled doesn’t work? 将测试,看看我是否可以使它工作 将mobileinit绑定移动到jquery之后,但在jquery-mobile完成之前.这似乎是MVC4(新)移动Web应用程序模板中的一个错误,它只是简单地将所有脚本捆绑在一起 这失败了…. <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" /> <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js")"></script> <script> $(document).bind("mobileinit",function() { // As of Beta 2,jQuery Mobile's Ajax navigation does not work in all cases (e.g.,// when navigating from a mobile to a non-mobile page,or when clicking "back" // after a form post),hence disabling it. $.mobile.ajaxEnabled = false; }); </script> 但这有效…. <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" /> <script src="../../Scripts/jquery-1.7.2.js" type="text/javascript"></script> <script src="../../Scripts/jquery-ui-1.8.11.js" type="text/javascript"></script> <script> $(document).bind("mobileinit",hence disabling it. $.mobile.ajaxEnabled = false; }); </script> <script src="../../Scripts/jquery.mobile-1.1.0.js" type="text/javascript"></script> <script src="../../Scripts/jquery.unobtrusive-ajax.js" type="text/javascript"></script> <script src="../../Scripts/jquery.validate.js" type="text/javascript"></script> <script src="../../Scripts/jquery.validate.unobtrusive.js" type="text/javascript"></script> <script src="../../Scripts/modernizr-2.5.3.js" type="text/javascript"></script> 谢谢… (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net – JITting是按照程序集还是按方法进行的?这对工作
- asp.net – Server.Transfer对Google不可见吗?
- asp.net-mvc-4 – 在控制器的新窗口中打开mvc视图
- asp.net – 谁负责处理HttpPostedFile.InputStream – 何时
- entity-framework – ASP.NET Web API中DbContext的推荐生命
- asp.net-mvc-5 – 使用FormsAuthenticationTicket的MVC Ide
- asp.net – 如何隐藏web api 2中的元数据,odata
- asp.net-mvc – MVC 3 RC上的全局过滤器注册错误
- 在ASP.NET MVC中模拟User.Identity
- asp.net-mvc – 如何在Ajax窗体的asp.net mvc中提交下拉列表