Solve the problem that the responseText returned by the server after ajax processing is JSON data. First, the contents of the file in json format are as follows: { "city":"ShangHai", "telephone":"123456789" } Second, the json data returned by the server is the above content in responseText. Now we need to get it out. There are two ways: Method 1: var json = JSON.parse(request.responseText); alert(json.city); Method 2: var result = request.responseText; var jsonObject = eval("("+result+")"); alert(jsonObject.telephone); This is the end of this article about the detailed case of Ajax responseText parsing json data. For more related Ajax responseText parsing json data content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of the installation and configuration process of mysql8.018 on linux
>>: Nginx prohibits direct access via IP and redirects to a custom 500 page
1. Javascript returns to the previous page history...
Process 1: with return value: drop procedure if e...
A list is defined as a form of text or chart that...
first step Delete it once with the built-in packa...
Overview An index is a table of correspondence be...
If you are using Alibaba Cloud Server, you need t...
Table of contents 1. df command 2. du command 3. ...
The official document states: By injecting the ro...
Table of contents Use of CURRENT_TIMESTAMP timest...
Table of contents Preface Do not use strings to s...
First, check whether the hard disk device has a d...
The code looks like this: SELECT @i:=@i+1 rowNum,...
Table of contents 1. Operate the database 1.1 Cre...
Html code: Copy code The code is as follows: <t...
Table of contents Prerequisites useEffect commitB...