There is a stupid task: load some data found on the url page in the script tag.

If done via .load(url + ' script') , then, according to the documentation

If, however, the script has been updated, it has been updated.

it does not bring the desired result (although some tags are still there: apparently, they are in other tags)

If you do it via .load(url) //без селлектора or .get(url) or .ajax(url) , (which, I understand, is about the same), I get

It is a synchronous XMLHttpRequest on the user's experience.

which breaks some of the functions of the page, which are not in my power to change. This XMLHttpRequest deprecated , apparently due to the fact that the callback for one of .load() is another .load() .

You cannot change the structure of the url page.

Here is a situevina)

How to be? Tell me!

Here, by the way, is the code structure:

 $(window).on('load', function() { $(element).on('click', function() { $store.load(url+' sellector', function() { // обычно хватает того, что тут написано, но if (/*что-то не так*/) /* то вот тут нужно загрузить содержимое тега <script> из url */ }); }); }) 

    1 answer 1

    The script uses XMLHttpRequest connects to the names.php file and extracts the src content from the <script> tag from it.

     var regex = /<script\s.*src="(.*)">/g; var req = new XMLHttpRequest(); req.open("GET", "/names.php"); req.onload = (function(){ var m = regex.exec(req.responseText) console.log(m[1]); }) req.send(); 
    • It is a synchronous XMLHttpRequest on the user's experience. - Rus
    • In this case, this does not apply to the example. Deliver and everything will work. From experience I can say that this is the most optimal solution - L. Vadim