开发者

How to submit a form using jQueryMobile

I'm unable to submit a form using method post.

  1. The first error that occured was a 405 but I was able to solved it using this solution.
  2. Now occurs a 403 error, how can I solve it?

JS

$(document).ready(function () {
    $('#loginForm').submit(function () {
        //some business logic...
        $.mobile.changePage($('#menuPage'));
    });
});

HTML

<div data-role="page" id="loginPage">
    <div data-role="header"><h1>Login</h1></div>
    <div data-role="content">
        <form method="post" id="loginForm">
            <fieldset>
                <label for="utilizadorText">Inserir Utilizador</label>
                <input type="text" id="utilizadorText" name="utilizadorText" />
                <label for="palavraChaveText">Inserir Palavra Chave</label>
                <input type="password" id="palavraChaveText" name="palavraChaveText" />
                <input type="submit" id="loginAnchor" class="submit" value="Login" />
            </fieldset>
        </form>
    </div>
</div>     

<div data-role="pag开发者_JAVA百科e" id="menuPage">
    <div data-role="header"><h1>Menu</h1></div>
    <div data-role="content">    
        Menu
    </div>
</div>       


It appears as though you are trying to submit the form to the loginPage and than change the page to menuPage. This doesn't make sense to me. What actions are you trying to perform here? If you want to be able to take form data from the context of the loginPage and than apply business logic to it than the solution below might help.

Possible Solution #1

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜