Accessing DOM object after AJAX call?

后端 未结 6 1888
南方客
南方客 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条回答
  •  萌比男神i
    2020-12-29 15:40

    If you want to decouple your code from the callback:

    functionWithALotOfStuffToDo = function(data){
      // do stuff here
    }
    
    $.ajax({
       url: url,
       success: functionWithALotOfStuffToDo
    });
    

提交回复
热议问题