jQuery .load() call doesn't execute JavaScript in loaded HTML file

后端 未结 13 1711
难免孤独
难免孤独 2020-11-22 08:28

This seems to be a problem related to Safari only. I\'ve tried 4 on Mac and 3 on Windows and am still having no luck.

I\'m trying to load an external HTML file and

相关标签:
13条回答
  • 2020-11-22 08:57

    I realize this is somewhat of an older post, but for anyone that comes to this page looking for a similar solution...

    http://api.jquery.com/jQuery.getScript/

    jQuery.getScript( url, [ success(data, textStatus) ] )
    
    • url - A string containing the URL to which the request is sent.

    • success(data, textStatus) - A callback function that is executed if the request succeeds.

    $.getScript('ajax/test.js', function() {
      alert('Load was performed.');
    });
    
    0 讨论(0)
提交回复
热议问题