After reading the jQuery .load()
documentation, at the "Script Execution" section, it said this:
Script Execution
When calling .load() using a URL without a suffixed selector expression, the content is passed to .html() prior to scripts being removed. This executes the script blocks before they are discarded.
Regarding the phrase "prior to scripts being removed", does this mean that the script will be removed and not added to the DOM? That only the HTML will be passed to document and updated in the DOM?
Regarding the phrase "this executes the script blocks before they are discarded", does it really mean that the script executes and then is discarded, and there is no means for us to call it later?
Even if the scripts are passed to the document, if the DOM is not updated, we can not call it later either, can we?
If all the answers to the questions above are yes, that means loading a javascript file using .load()
can only be an instant execution after .load()
is finished loading, right? And that there is no mean to call that script again after .load()
, because it is discarded and gone?