Home  >  Article  >  Web Front-end  >  jQuery repeated loading error and how to fix it_jquery

jQuery repeated loading error and how to fix it_jquery

WBOY
WBOYOriginal
2016-05-16 16:26:471553browse

When I was working on a project recently, I encountered a problem:

The parent page imports the child page, the child page imports the jQuery.js file, and the parent page JS depends on jQuery.js. The problem is that it always prompts that the JS object is invalid. I guess the jQuery loading order is not the earliest.

Parent page:


Subpage:


From here, jQuery.js is the earliest, but why do other js prompts that the attributes are invalid.

Later, I used the F12 tool of IE11 to check the loading order of JS and found that jQuery was loaded first. However, after the page was loaded, there was a sudden request to load jQuery again.



The reason is the following code:

Copy code The code is as follows:

$(function() {
$("#zjyw_table_1").load("xxx.jsp");
}

jQuery.js is loaded again in xxx.jsp. After commenting this sentence, it will be normal.

This issue has been frustrating me for a long time. I will record it for the convenience of others.

After finding the method, the solution is very simple. The main purpose here is to share with you the ideas for querying the problem. At the same time, friends who have the same problem can refer to it.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn