executing script after jQuery Ajax Call

前端 未结 2 482
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-21 19:22

I load some HTML code into a div with the .load function af jQuery that contains some code I want to execute;

$.ajax({
    type: \"GET\",
    url: url,
    dataT         


        
2条回答
  •  孤城傲影
    2021-01-21 20:18

    Why wouldn't you use the callback function that's already available in your ajax call?

    $.ajax({
    type: "GET",
    url: url,
    dataType: "html",
    success: function(data){
        alert('TEST'); //this works
        someFunction("#debug",'var');//this doesn't
    }});
    

    I would take a closer look at how you are architecting the code

提交回复
热议问题