The relationship between jquery and ajax is described in detail

  • 2020-03-30 00:39:49
  • OfStack

JQuery and AJAX are both frameworks of Javascript, each with its own different functions. If Javascript is compared to a father, JQuery and AJAX are the biological sons of Javascript. Very complex functions in Javascript are extremely convenient and quick to implement. The following is a summary of their respective functions and features 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 makes it easier for users to work with HTML documents, events, animate, and easily provide AJAX interactions for websites. JQuery also has a number of mature plug-ins to choose from. JQuery allows the user's HTML page to keep the code separate from the HTML content, which means that instead of inserting a bunch of js commands into the HTML, you just define the id.

JQuery is all about WRITE LESS,DO MORE. Let us programmers write less code and do more.

And when is JQuery used? Similar to the above, its main use is:

1. The selector

The $sign allows you to quickly and precisely locate the specified element. Selectors include: basic selectors, level selectors, filter selectors, form selectors

2. DOM manipulation

Find the DOM element through the $sign, and operate on the attribute; Add delete node; Operate on the style; Set to get HTML text and values; Traversing child or peer elements; Add event

3. Form validation

4. Animation

5. Ajax

This is JQuery, but let's move on to AJAX.

AJAX is "AsynchronousJavaScript and XML" (AsynchronousJavaScript and XML). Asynchronous means that the browser can still do other things after the event is triggered, and the control that is not related to the control where the event occurred is not affected. AJAX is a technique for creating better, faster, and more interactive Web applications.

If you only learn to use a few controls of AJAX in.net, you may not understand what Javascript and XML in AJAX are all about. These controls encapsulate them. To understand the use of Javascript and XML, you also need to understand how the client accepts Webservice (.asmx) and WCF (.svc) and general handler (.ashx) files

So when do you normally use AJAX, and when is a good time 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. Vote, choose or not, grade evaluation

5. Filtering and complex data manipulation

6. Prompt for general input/auto completion

Situations where AJAX is not appropriate:

1. A simple form

2. Search

3. Basic navigation

Replace a lot of information

5. Display operations

Useless web widgets

Related articles: