相关疑难解决方法(0)

使用jQuery ajax response html更新div

我正在尝试使用ajax html响应中的内容更新div.我相信我的语法正确,但div内容被替换为整个HTML页面响应,而不仅仅是在html响应中选择的div.我究竟做错了什么?

    <script>
        $('#submitform').click(function() {
            $.ajax({
            url: "getinfo.asp",
            data: {
                txtsearch: $('#appendedInputButton').val()
            },
            type: "GET",
            dataType : "html",
            success: function( data ) {
                $('#showresults').replaceWith($('#showresults').html(data));
            },
            error: function( xhr, status ) {
            alert( "Sorry, there was a problem!" );
            },
            complete: function( xhr, status ) {
                //$('#showresults').slideDown('slow')
            }
            });
        });
    </script>
Run Code Online (Sandbox Code Playgroud)

ajax jquery get asp-classic replacewith

37
推荐指数
2
解决办法
18万
查看次数

标签 统计

ajax ×1

asp-classic ×1

get ×1

jquery ×1

replacewith ×1