Tag: replacewith

用jQuery ajax响应html更新div

我正在尝试从ajax html响应的内容更新div。 我相信我有正确的语法,但div内容被replace为整个HTML页面响应,而不是在HTML响应中select的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>