js file dynamic loading calling problem
按键盘手指磨破皮
按键盘手指磨破皮 2017-09-02 17:05:23
0
1
1332

A JS file A is initially loaded in the original html file, which contains a large number of functions.

When an external JS file B is loaded after executing an event, JS file B calls the function in file A. Logically speaking, JS file A has been loaded successfully after the page is loaded, and the imported JS file B should You can use it directly. Why can't you call the function in file A? An error will be reported. . .

a.js content:

Function 1,

Function 2,

$('#btn3').unbind('click'). click(function(e){

e.stopPropagation();

$.getScript('b.js');

})

b.js content:

Function 1();

After b.js is loaded successfully, no other elements can be added except calling functions. No problem. What is the reason?

按键盘手指磨破皮
按键盘手指磨破皮

reply all(1)
Ty80

You can take a screenshot of the error, it may be a function scope issue.

  • reply The error message is that this function does not exist adeu is not defined adeu is a function
    按键盘手指磨破皮 author 2017-09-04 11:33:21
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!