Home > Article > Web Front-end > What is the difference between json and jquery
The difference between json and jquery: 1. jquery is a JavaScript library, while json is a lightweight data exchange format; 2. jquery is used to simplify complex operations of JavaScript, while json is often used on the server side Pass data to the web page.
The operating environment of this tutorial: windows10 system, jquery3.4.1 version, Dell G3 computer.
JQUERY is a JS framework; JSON is a representation of data.
json is a simple data exchange format. For example-->[{name:'nice',age:19},{"name":'andy',"age":"58"}]; jquery in It is optimized and extended based on javascript to simplify the complex operations of javascript
Detailed introduction:
json
JSON is a format used to store and transmit data.
JSON is usually used by the server to transfer data to the web page.
What is JSON?
The full English name of JSON is JavaScript Object Notation
JSON is a lightweight data exchange format.
JSON is easy to understand.
* JSON uses JavaScript syntax, but the JSON format is just text. Text can be read by any programming language and passed as data format.
JSON Example
The following JSON syntax defines the sites object: An array of 3 website information (objects):
{“sites”:[{“name”:“Runoob”, “url”:“www.runoob.com”},{“name”:“Google”, “url”:“www.google.com”},{“name”:“Taobao”, “url”:“www.taobao.com”}]}
JSON formatted as JavaScript Object
The JSON format is syntactically identical to the code that creates the JavaScript object.
Because they are similar, JavaScript programs can easily convert JSON data into JavaScript objects.
JSON syntax rules
Data is key/value pairs.
Data is separated by commas.
Braces save the object
Square brackets save the array
JSON data - one name corresponds to one value
JSON data format is key/value pair, that is Like JavaScript object properties.
jquery
jQuery is a JavaScript library (framework) that obtains a set of defined methods by encapsulating native JavaScript functions. Its author is John Resig, an open source project created in 2006. As more and more developers join, JQuery has integrated powerful functions of JavaScript, CSS, DOM and Ajax. It can complete more complex and difficult functions with the least code, thus gaining the favor of developers.
JQuery is a JavaScript encapsulated library, its purpose is to simplify developers' use of JavaScript. The main functions are as follows:
1. Access and operate DOM like CSS
2. Modify CSS to control page appearance
3. Simplify JavaScript code operations
4.Event handling is easier
5.Various animations The effect is easy to use
6. Make Ajax technology more perfect asynchronous loading
7. Based on a large number of jQuery plug-ins
8. Self-extended function plug-in JQuery
The biggest advantage is that it is particularly convenient. For example, imitating CSS to obtain the DOM is much more convenient than native JavaScript. And the centralized processing of multiple CSS settings is very comfortable, and the most commonly used CSS functions are encapsulated into separate methods, which feels very thoughtful. The most important thing is that jQuery’s code compatibility is very good, you don’t always need to have a headache
Video tutorial recommendation:jQuery video tutorial
The above is the detailed content of What is the difference between json and jquery. For more information, please follow other related articles on the PHP Chinese website!