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 !)
In the past, XML was the darling of programmers and the best choice for data transmission, API, and Ajax applications. In particular, when encountering Ajax applications, XMLHttpRequest checks the MIME type of the returned data, if it is of the text/XML type, XMLHttpRequest runs XML parser to parse the returned document and build the corresponding DOM tree in the memory, you can use the Javascript standard DOM method to operate the DOM tree. As we all know, Dom is not an efficient method. Another problem is that if you want to use JavaScript objects instead of XML data directly, you have to traverse the entire DOM tree to create the corresponding objects.
As a result, JSON was born.
JSON provides a standard data exchange format that is more suitable for Ajax applications. JSON (JavaScript Object Notation) is a lightweight data exchange format. Easy to read and write. It is also easy to parse and generate machines.
JSON has many advantages, but it also has shortcomings. Although XML does have many problems, we recommend you refer to the old K blog for comparison between the two.
This article mainly demonstrates how to use jquery. Ajax to obtain JSON and XML data in the background. For more information about the two, see the recommendation blog.
Client code
<% @ Page Language = "C #" autoeventwireup = "true" codebehind = "jsonxmltest. aspx. cs" inherits = "jqueryajaxtest. jsontest" %> <! 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">
Server XML file content
<?xml version='1.0' encoding='UTF-8'?><employees> <name> <firstName>Bill</firstName> <lastName>Gates</lastName> </name> <name> <firstName>George</firstName> <lastName>Bush</lastName> </name> <name> <firstName>Thomas</firstName> <lastName>Carter</lastName> </name></employees>
Server JSON File Content
{"employees": [{ "firstName":"Bill" , "lastName":"Gates" },{ "firstName":"George" , "lastName":"Bush" },{ "firstName":"Thomas" , "lastName":"Carter" }]}
Because jquery is used, parsing XML and JSON on the client does not seem to be much different. However, if native Javascript is used, the comparison is obvious, read this article to compare Java + JavaScript + XML with Java + JavaScript + JSON
I personally feel that XML is unparalleled on the server, but the advantage of JSON on the client is also obvious. XML and JSON are both superior and inferior, and they are not easy to draw conclusions based on your preferences. A good programmer, both of them should be proficient and adapt to the situation.
ASP. NET + jquery. Ajax:
Finally, according to my plan in the first article, I completed this series of articles. Looking back, the content is actually quite simple, but I still finish it seriously. If there is any inaccuracy, it will be corrected and supplemented in the future.
In fact, I want to write it into an article at the beginning, which will inevitably lead to the "rough summary" result. It is likely that I cannot make it clear at all, later, I thought that if there is no foundation, I would definitely be confused. Finally, I decided on an instance and an instance. In a little bit, I spoke about 10 articles for different readers, I don't know clearly, and I don't know the best solution, but I have done my best to make it clear and make it more reasonable. There are not many content involved, which can help readers get a well-spoken jquery. Ajax Foundation. If you don't look at the function, please try again.
It should be emphasized that this is the foundation of jquery. Ajax, and it is true only when it is applied to projects flexibly. Come on, everybody. Come on, Jia Lin.