Accessing DOM object after AJAX call?

后端 未结 6 1898
南方客
南方客 2020-12-29 14:57

I have a typical AJAX call that appends some HTML to the current page. I want to be able to access the newly inserted HTML with typical jQuery selectors.

Here\'s wha

6条回答
  •  佛祖请我去吃肉
    2020-12-29 15:31

    Actually this sort of things can be solved by following way: (I know it is similar to others, but a little bit more clear)

    $.ajax({
       url: url,
       success: function(data) {
          $('body').append(data);
          afterHtmlAppendCallback();
       }
    });
    function afterHtmlAppendCallback()
    {
        $('#new_div').show();
    }
    

提交回复
热议问题