[
{ "CategoryId": 1,
"CategoryName": "set network",
"IconCls": "category-item-button-icon-network" },
{ "CategoryId": 2,
"CategoryName": "play the game",
"IconCls": "category-item-button-icon-game" }
]
I js file how to read this file class content?
ask god to help. .
------ Solution ------------------------------------ --------
A complete json should be contained by the brace bar (eg {data: [{name: 'aa', age: 3}, {name: 'aa', age: 3} ...... ..]})
you this. . It can only be called an array. . Have to have a name, such as arrayA = [{name: 'aa', age: 3}, {name: 'aa', age: 3} ...]
then call it is the arrayA [0]. name ....
------ Solution -------------------- ------------------------
[First, take out things that are strings. Because you outside with the [] enclosed, which is two elements, each element is enclosed in curly braces. When you put this element as a javaBean, then categoryId, categoryName, iconCls is its attributes. The value of the time, if you want to take the "play game", this value, it is necessary so write: data [1]. CategoryName. And so on, are so written on the line. . .
{ "CategoryId": 1,
"CategoryName": "set network",
"IconCls": "category-item-button-icon-network" },
{ "CategoryId": 2,
"CategoryName": "play the game",
"IconCls": "category-item-button-icon-game" }
]
------ Solution ---------------------------------------- ----
First, take out things that are strings. Because you outside with the [] enclosed, which is two elements, each element is enclosed in curly braces. When you put this element as a javaBean, then categoryId, categoryName, iconCls is its property
------ Solution -------------------- ------------------------
$. post ('xxxx.jsp | js | html (and other documents)','', function (data) {
alert (data); / / output string is the file inside
});
------ Solution --------------------------------- -----------
$. getJson ("xxx.json", function (data) {
/ / data that is inside the contents of this document and has an array of
})
------ For reference only -------------------------------- -------
amount. . . Right, on the first floor right. . . I really to ignore this, but the value it that way as I say come on line
------ For reference only ---------------------------------- -----
amount. . This file is on the outside. . My question is how to read the js file. . . ajax request method? I do not know how to write. . .
------ For reference only -------------------------------------- -
jquery's ...
------ For reference only ------------------------ ---------------
I want ajax method. . . .
------ For reference only -------------------------------------- -
get, or see help documentation useful. .
------ For reference only -------------------------------------- -
how to get in? Code stickers
没有评论:
发表评论