用jq怎么解析res
发布网友
发布时间:2022-04-25 15:07
我来回答
共1个回答
热心网友
时间:2023-10-11 01:51
//举例
$.ajax({ url: "/jqdemo/jquery-ui-1.9.2.custom/dev/ui.button.jquery.json", dataType: "json" })
.done(function (result) {//ajax的done解析result
$.each(result, function (key,value) {
console.log(key + " " + value); //动态解析result的key和value
})
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//ui.button.jquery.json格式为:
{
"name": "ui.button",
"title": "jQuery UI Button",
"description": "Enhances a form with themable buttons.",
"keywords": [
"ui",
"button",
"form",
"radio",
"checkbox"
],
"version": "1.9.2",
"author": {
"name": "jQuery Foundation and other contributors",
"url": "https://github.com/jquery/jquery-ui/blob/1.9.2/AUTHORS.txt"
},
"maintainers": [
{
"name": "Scott González",
"email": "scott.gonzalez@gmail.com",
"url": "http://scottgonzalez.com"
},
{
"name": "Jörn Zaefferer",
"email": "joern.zaefferer@gmail.com",
"url": "http://bassistance.de"
},
{
"name": "Kris Borchers",
"email": "kris.borchers@gmail.com",
"url": "http://krisborchers.com"
},
{
"name": "Corey Frang",
"email": "gnarf37@gmail.com",
"url": "http://gnarf.net"
}
],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jquery/jquery-ui/blob/1.9.2/MIT-LICENSE.txt"
}
],
"bugs": "http://bugs.jqueryui.com/",
"homepage": "http://jqueryui.com/button/",
"demo": "http://jqueryui.com/button/",
"docs": "http://api.jqueryui.com/button/",
"download": "http://jqueryui.com/download/",
"dependencies": {
"jquery": ">=1.6",
"ui.core": "1.9.2",
"ui.widget": "1.9.2"
},
"category": "widget"
}