-3

私はこのコードを使用する必要があります:

<div data-role="content">
            <div data-role="content">
                <form id="registerForm" action="/register" method="post" data-ajax="false" class="ui-body ui-body-a ui-corner-all">
                    <fieldset>
                        <div data-role="fieldcontain">
                            <label for="rUIdInput">Email:</label>
                            <input name="<%=User.USER_ID%>" id="rUIdInput" value="" type="email" placeholder="your.mail@abc.com" /> 
                            <label for="rUPwInput">Password:</label>
                            <input name="<%=BasicAuthRedirectServlet.PASSWORD%>" id="rUpwInput" value="" type="password" placeholder="Your password" />
                        </div>
                        <button type="submit" data-theme="b">Register</button>
                    </fieldset>
                </form>
            </div>
        </div>

登録ボタンをクリックしていくつかの値を入力し、登録を押すと、JSONオブジェクトが返されます。このJSONオブジェクトのハンドルを取得する方法がわかりません

ありがとう!

4

1 に答える 1

0

うまくいけばPOST、フォームのデータをにする必要があると思います/register。その場合、これはあなたが従う必要があるものです。ボタンは次のとおりです。

<button type="submit" data-theme="b">Register</button>

jQuery(またはjQM)を使用すると、次のことができます。

  1. IDボタンとフォームにを与えます。

    <form id="registerFrm" action="/register" method="post" data-ajax="false" class="ui-body ui-body-a ui-corner-all">
    
    <button type="submit" data-theme="b" id="registerBtn">Register</button>
    
  2. 次は、ボタンアクションのハンドラーを設定します。

    $(document).ready(function(){
        $("#registerBtn").click(function () {
            $.ajax({
                url: $("#registerFrm").attr("action"),
                data: $("#registerFrm").serialize(),
                type: "POST",
                success: function (data) {
                    alert(data);
                }
            })
        });
    });
    

これがあなたのために働いたかどうかを言います。

于 2012-10-11T10:47:11.820 に答える