What does json in ajax mean?
In ajax, json is a data format that can be transferred between different languages. It is a lightweight data exchange format, which is used to exchange data between the browser and the server. JSON is easy to understand and data exchange is faster than XML; it supports arrays, objects, strings, numbers, and values.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
Ajax-JSON basic concept
JSON basic concept
JSON full name" "JavaScript Object Notation" is a data format that can be transferred between different languages, a lightweight data exchange format.
In AJAX, it is used to exchange data between the browser and the server. It's easy to understand and data exchange is faster than XML. It supports arrays, objects, strings, numbers and values.
Send a request through AJAX, and the server obtains a JSON data
Comparison between json and xml
xml is also a method of transmitting information .
1. The length of json is very short compared to the xml format.
2. The speed of reading and writing json is faster.
3. json can be parsed directly using the built-in method of javaScript and converted into a javaScript object, which is very convenient.
json syntax rules
1. The writing format of json data is: name/value pair.
The name in the name/value pair combination is written in front (in double quotes), the value pair is written in the back (also in double quotes), separated by colons, such as "name":"Guo Jing ".
Different from javaScript object notation, the key values of javaScript object notation do not need to be quoted, but the key values of json must be quoted.
2. The value of json can be of the following types:
(1) Number (integer or floating point number), such as 123, 1.23
(2) String ( in double quotes)
(3) logical value (true or false)
(4) array (in square brackets)
(5) object (in flower In brackets)
(6) null
3. Typical example of json:
{ "staff":[ {"name":"洪七","age":70}, {"name":"郭靖","age":35} ] }
json parsing
1. json in There are two ways to parse in js: eval and JSON.parse
2. It is very dangerous to use eval in code, especially using it to execute third-party JSON data (which may contain malicious code)
var jsonval= {"staff": [{"name": "洪七","age": 20}, {"name": "洪七2","age": 20}, {"name": "洪七3","age": 20}]}
1) eval()
var jsonbj=('('+jsonval+')');----解析 jssonbj.employees[0].firstName----访问
2) JSON.parse()
var data = JSON.parse(jsonval);---解析 jssonbj.employees[0].firstName----访问
[Related tutorial recommendations: AJAX video tutorial]
The above is the detailed content of What does json in ajax mean?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Title: Methods and code examples to resolve 403 errors in jQuery AJAX requests. The 403 error refers to a request that the server prohibits access to a resource. This error usually occurs because the request lacks permissions or is rejected by the server. When making jQueryAJAX requests, you sometimes encounter this situation. This article will introduce how to solve this problem and provide code examples. Solution: Check permissions: First ensure that the requested URL address is correct and verify that you have sufficient permissions to access the resource.

MySQL5.7 and MySQL8.0 are two different MySQL database versions. There are some main differences between them: Performance improvements: MySQL8.0 has some performance improvements compared to MySQL5.7. These include better query optimizers, more efficient query execution plan generation, better indexing algorithms and parallel queries, etc. These improvements can improve query performance and overall system performance. JSON support: MySQL 8.0 introduces native support for JSON data type, including storage, query and indexing of JSON data. This makes processing and manipulating JSON data in MySQL more convenient and efficient. Transaction features: MySQL8.0 introduces some new transaction features, such as atomic

jQuery is a popular JavaScript library used to simplify client-side development. AJAX is a technology that sends asynchronous requests and interacts with the server without reloading the entire web page. However, when using jQuery to make AJAX requests, you sometimes encounter 403 errors. 403 errors are usually server-denied access errors, possibly due to security policy or permission issues. In this article, we will discuss how to resolve jQueryAJAX request encountering 403 error

Performance optimization methods for converting PHP arrays to JSON include: using JSON extensions and the json_encode() function; adding the JSON_UNESCAPED_UNICODE option to avoid character escaping; using buffers to improve loop encoding performance; caching JSON encoding results; and considering using a third-party JSON encoding library.

Annotations in the Jackson library control JSON serialization and deserialization: Serialization: @JsonIgnore: Ignore the property @JsonProperty: Specify the name @JsonGetter: Use the get method @JsonSetter: Use the set method Deserialization: @JsonIgnoreProperties: Ignore the property @ JsonProperty: Specify name @JsonCreator: Use constructor @JsonDeserialize: Custom logic

Using Ajax to obtain variables from PHP methods is a common scenario in web development. Through Ajax, the page can be dynamically obtained without refreshing the data. In this article, we will introduce how to use Ajax to get variables from PHP methods, and provide specific code examples. First, we need to write a PHP file to handle the Ajax request and return the required variables. Here is sample code for a simple PHP file getData.php:

How to solve the problem of jQueryAJAX error 403? When developing web applications, jQuery is often used to send asynchronous requests. However, sometimes you may encounter error code 403 when using jQueryAJAX, indicating that access is forbidden by the server. This is usually caused by server-side security settings, but there are ways to work around it. This article will introduce how to solve the problem of jQueryAJAX error 403 and provide specific code examples. 1. to make

In-depth understanding of PHP: Implementation method of converting JSONUnicode to Chinese During development, we often encounter situations where we need to process JSON data, and Unicode encoding in JSON will cause us some problems in some scenarios, especially when Unicode needs to be converted When encoding is converted to Chinese characters. In PHP, there are some methods that can help us achieve this conversion process. A common method will be introduced below and specific code examples will be provided. First, let us first understand the Un in JSON
