Questions about the invalidity of jQuery:$.getScript

now I need to load the EasyUI component dynamically, because my page is embedded in iframe

loads correctly and the component takes effect in the following ways

var script = parent.document.createElement("script");
script.type = "text/javascript";
script.src = "easyUI/jquery.easyui.min.js";
parent.document.getElementsByTagName("head")[0].appendChild(script);

now I want to change it to the following form to load correctly, but the component does not take effect

$.getScript("easyUI/jquery.easyui.min.js", function( data, status, jqXHR ) {

});

shows $("- sharpwin"). Window is not a function) and is indeed not loaded into the component in the prototype chain

have any seniors encountered similar problems? Or where should I start?

the method is described as follows in the official API

The script is executed in the global context, so it can refer to other variables and use jQuery functions. Included scripts can have some impact on the current page.

is it because the first way is to load into the head, where the iframe is located and the second way is to load to the top-level head?

Mar.10,2021

your first way parent.document this is done on the parent page.
and the second is what is done on the current page, which is definitely different.

Menu