0

こんにちは、私は現在、以下のコードを使用して自分のページで ajax 送信を実行していますが、ユーザー データのキャプチャに使用されるさまざまな方法を考えると、これが最も効果的な処理方法であるかどうか疑問に思っていました。

より良い方法は何を伴いますか?

これは私が現在使用している JavaScript コードです。

$(document).ready(function() {
    $("#submit").click(function() {
        $("#form").hide(300);
        $.post('run.php', $("#form").serialize(), 
        function(data) {
            $("#result").html(data);
        });
        return false;
    });
});

これは私のフォームです:

<form id="booking">
          <table width="600" cellpadding="2px" cellspacing="2px" style="font-size: 20px;">
            <tr>
              <th width="296" align="left">Date Of Wedding</th>
              <td width="288"><input name='date' type='text' class='larger' id='date' value='' size='20'/></td>
            </tr>
            <tr>
              <th align="left">Party Size</th>
              <td><input name='partySize' type='text' class='larger' id='partySize' value='' size='20' /></td>
            </tr>
            <tr>
              <th align="left">Catering Grade</th>
              <td>1:
                <input name='cateringGrade' type='radio' class='larger' value=1 size='12'/>
                2:
                <input name='cateringGrade' type='radio' class='larger' id='cateringGrade' value=2 size='12'/>
                3:
                <input name='cateringGrade' type='radio' class='larger' id='cateringGrade' value=3 size='12'/>
                4:
                <input name='cateringGrade' type='radio' class='larger' id='cateringGrade' value=4 size='12'/>
                5:
                <input name='cateringGrade' type='radio' class='larger' id='cateringGrade' value=5 size='12'/></td>
            </tr>
            <tr>
              <th align="left">&nbsp;</th>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <th align="left">&nbsp;</th>
              <td><input name="submit" type="button" value="Submit" id="submit"/></td>
            </tr>
          </table>
        </form>
4

2 に答える 2