JQuery and AJAX are both frameworks of Javascript, each with its own different functions. The following is an introduction to the relationship between jquery and ajax. Friends who don’t understand can refer to
JQuery and AJAX are both frameworks of Javascript, each with its own different functions. If Javascript is compared to its father, JQuery and AJAX are the biological sons of Javascript. Very complex functions in Javascript are extremely convenient and quick to implement. Let's summarize their respective functions, characteristics and application occasions.
JQuery is a lightweight js library that is compatible with CSS3 and various browsers (IE 6.0+, FF1.5+, Safari 2.0+, Opera 9.0+). jQuery enables users to more easily process HTML documents, events, implement animation effects, and easily provide AJAX interaction for websites. jQuery also has many mature plug-ins to choose from. jQuery can keep the code and html content of the user's html page separated. In other words, there is no need to insert a bunch of js in the html to call the command. You only need to define the id.
The purpose of JQuery is - WRITE LESS, DO MORE, which means "eat less, do more". Let our programmers write less code and do more things.
When is JQuery used? Similar to what was said above, its main uses are:
1. Selector
You can quickly and accurately locate the specified element through the $ symbol. Selectors include: Basic selector, hierarchical selector, filter selector, form selector
2. Operation on DOM
Through $ The symbol finds the DOM element and operates on the attributes; adds and deletes nodes; operates on styles; sets and gets HTML text and values; traverses child elements or sibling elements; adds events
3. Form Validation
4. Animation effect
5. ajax
The above summary is about JQuery, and we will continue to summarize AJAX below.
AJAX stands for "Asynchronous JavaScript and XML" (asynchronous JavaScript and XML). The so-called asynchronous means that the browser can still do other things after the event is triggered, and controls unrelated to the control where the event occurred are not affected. AJAX is a technology used to create better, faster, and more interactive web applications.
If you only learn to use a few AJAX controls in .net, you may not understand what Javascript and XML in AJAX are all about. These controls are encapsulations of them. Microsoft makes it convenient for us. A lot, but it's a "foolproof" way to use it. In order to deeply understand the use of Javascript and XML, you also need to understand how the client accepts Webservice (.asmx) and WCF (.svc) and the use of general processing program (.ashx) files
So when do you generally use AJAX, and when is it more appropriate to use AJAX? It is generally used where local changes occur on the page. As follows:
1. Form-based interaction
2. Deep tree Navigation
3. Real-time user-to-user communication
4. Voting, selection, rating
5. Filtering and complex data operations
6. Prompts/automatic completion during normal entry
Not applicable using AJAX Occasions:
1. Simple form
2. Search
3. Basic navigation
4. Replace a large amount of information
5. Display operations
6. Useless web widgets
The above is the detailed content of A detailed introduction to the relationship between jquery and ajax. For more information, please follow other related articles on the PHP Chinese website!