reload script

In web development, we will have inexplicable errors. Obviously, js scripts have been introduced, but js still cannot be found at runtime. At this time, we can consider whether js is successfully loaded, so we need to manually load scripts by ourselves. The following is the method provided by jquery:

jQuery.getScript(url, [callback])

loads and executes a JavaScript file via an HTTP GET request.
Before jQuery 1.2, getScript could only call JS files of the same domain. In 1.2, you can call JavaScript files across domains. Note: Safari 2 or earlier cannot execute scripts synchronously in the global scope.
If adding script via getScript, please add delay function.

Parameters
url,[callback]String,FunctionV1.0
url: The address of the JS file to be loaded.
callback: callback function after successful loading.

eg:
$.getScript("test.js", function(){
  alert("Script loaded and executed.");
});


50 essential practical jQuery code snippets + 15 jQuery codes that can be used directly Snippet
http://www.cnblogs.com/zfc2201/p/3298955.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326803662&siteId=291194637