简体   繁体   English

使用不带ajax的post方法提交表单(jQuery Mobile)

[英]SUBMIT form using post method without ajax (jquery mobile)

I'm doing login form which looks like: 我正在做的登录表单如下所示:

<head> 
    <script src="http://code.jquery.com/jquery-1.5.min.js"></script>
    <script src="../sp/jqm/jquery.mobile.js"></script>
    <script type="text/javascript">
    $(document).bind("mobileinit", function(){
        $.extend(  $.mobile , {
            ajaxFormsEnabled: false,
            ajaxEnabled: true
        });
    });

    </script>
    <link rel="stylesheet" href="../sp/jqm/jquery.mobile.min.css" />
</head>
<body>
    <div data-role="page" data-theme="b"> 
        <div data-role="header">
            <h1>Login</h1>
        </div> 
        <div data-role="content">
            <form action="login_act.asp" method="POST" id="frm_prijava" name="frm_prijava">
                <div data-role="fieldcontain">
                    <label for="username"> User name:</label>
                    <input type="text" name="username" id="username" value=""  />
                    <label for="pass">Password:</label>
                    <input type="password" name="pass" id="pass" value=""  />
                    <input type="submit" name="sbm" id="sbm" data-role="button" value="Enter" /> 
                </div>
            </form>
        </div> 
    </div> 
</body>

When i try to submit form, dialog pops up and nothing happens... it just loads the page... 当我尝试提交表单时,对话框弹出,没有任何反应...它只是加载页面...

how can I submit this form without ajax? 我如何在没有ajax的情况下提交此表单?

Try executing your mobileinit event before jQuery Mobile is loaded 尝试在加载jQuery Mobile之前执行mobileinit事件

The mobileinit event is triggered immediately upon execution, you'll need to bind your event handler before jQuery Mobile is loaded. mobileinit事件在执行后立即触发,您需要在加载jQuery Mobile之前绑定事件处理程序。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM