0

私はこのコードを使用しています

<script>
    $(document).ready(function() {
        $.ajaxSetup({ cache: false });  //stops it caching the values so form can be change and the result updated without need for refreshing the page
    });
    $(function() {
        $('#select_user').live('submit', function(e) {      
            e.preventDefault(); // stops form from submitting naturally
            $.ajax({
                data: $(this).serialize(),
                url: $(this).attr('action') ,  //gets the form url from the atribute 'action' on the form.
                success: function(response) {
                    $('#result').html(response); 
                }
            });
        });
    }); 
</script>

あまりにも ajax リクエストを生成し、フォームから別のファイルに変数を渡しますが、これは正常に機能しています。div 'result' に出力されるファイルには別の形式があり、これを 'result' にロードされるファイル内の別の div に渡したいと考えています。出力されるさまざまなフォーム名とdivを変更するコードをコピーすることを望んでいましたが、これはうまくいきませんでした。私がこれを行う方法についてのアイデア。

できる限り説明しようとしましたが、少し混乱することは承知しています。

ありがとう!

4

0 に答える 0