Directory (updated articles will be connected, and an article will be updated every two to three days starting from March 13, July 25 ):
ASP. NET + jquery. Ajax details 1-opening section (published on February 25)
ASP. NET + jquery. Ajax details 2-$. Load (published on 2012.07.26)
ASP. NET + jquery. Ajax details 3-$. Get and $. Post (published on February 30)
ASP. NET + jquery. Ajax details 4-$. getjson (published on February 31)
ASP. NET + jquery. Ajax details 5-$. getscript (2012.08.04)
ASP. NET + jquery. Ajax details 6-$. ajaxsetup (2012.08.06)
ASP. NET + jquery. Ajax details 7-Global Ajax events (published on 2012.08.09)
ASP. NET + jquery. Ajax details 8-core $. Ajax (published on February 12)
ASP. NET + jquery. Ajax details 9-serialize and serializearray (February 15)
ASP. NET + jquery. Ajax detailed description: 10-json and XML + are written at the end of the article (published on February 20 !)
Jquery. getscript (URL, [callback])
Load and execute a Javascript file through an http get request.
URL: the URL of the JS file to be loaded.
Callback: callback function after successful loading.
The jquery internal implementation of this function still uses the get function. getscript imports the type parameter with the value of "script". Finally, the Ajax function processes the request with the type as script as follows:
var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script");script.src = s.url;
The above JS Code creates a script statement block and adds it to the head:
Head. appendchild (SCRIPT );
After the script is loaded, the JS Code deleted from the header will be omitted. If you are interested, study jquery.
I only did a non-Cross-origin test, and I will have time to complete another cross-origin test.
Instance:
Client --
<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "jqueryajaxgetscript. aspx. cs" inherits = "jqueryajaxtest. jqueryajaxgetscript" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">
The javascript code in test. js requested by the client is as follows:
Alert ("the Javascript file test. js of the getscript request has been loaded! ");
The test code is simple and the results are clear at a glance.