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