表单发送获取请求而不是发布

时间:2013-07-31 15:37:57

标签: ajax jquery-mobile post

这是HTML:

<form id="login_form" data-ajax="false">
     <label for="username" class="ui-hidden-accessible">Username:</label>
     <input type="text" name="username" id="username" value="" placeholder="Username"/>
     <label for="password" class="ui-hidden-accessible">Password:</label>
     <input type="password" name="password" id="password" value="" placeholder="Password"/>
     <button data-theme="b" id="submit" type="submit">Login</button>
</form>  

这是js:

$('#login_form').on('submit', function (e) {
    var $this       = $(this);
    e.preventDefault();

    //some validation here

    if (formValid)
    {
        $.mobile.showPageLoadingMsg();
        $.post(loginURL, $this.serialize(), function (response) {
            $.mobile.hidePageLoadingMsg();  
            //response handling here
        }, 'jsonp');
    }
    return false;
});  

所以问题是:
表单仍然发送GET查询 这有什么不对?
PS:如果重要的话,在纹波仿真器上进行测试

0 个答案:

没有答案
相关问题