Home > Web Front-end > JS Tutorial > A simple example of jQuery parsing json format data_jquery

A simple example of jQuery parsing json format data_jquery

WBOY
Release: 2016-05-16 15:18:59
Original
1304 people have browsed it

The example in this article describes how jQuery parses json format data. Share it with everyone for your reference, the details are as follows:

The version of jquery I use is 1.7.2, which integrates the parsing function of json data. It was not available in very early versions. I remember that at that time, you could either use the for in of js to read the data in the json string. Either load a JS file specifically used to parse json strings.

Example:

<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function () {
 var json_string = '[["a","b","c"],[1,2,3]]'; //二维数组,json_encode后的字符串
 json_array = JSON.parse(json_string); //json解析
 for(i=0;i<json_array.length;i++){
  for(j=0;j<json_array[i].length;j++){
   alert(json_array[i][j]);
  }
 }
});
</script>
</head>
<body>
</body>
</html>

Copy after login

Readers who are interested in more content related to jQuery operating json can check out the special topic of this site: "A summary of jQuery operating json data techniques"

I hope this article will be helpful to everyone in jQuery programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template