Bonjour,
je débute avec jquery, je n'arrive pas à obtenir tous les CategoryName d'un json avec mon jquery:
Et voici mon jquery.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 [ { "CategoryID": 1, "CategoryName": "Beverages", "Description": "Soft drinks, coffees, teas, beers, and ales", "Picture": { "Length": 10746 } }, { "CategoryID": 2, "CategoryName": "Condiments", "Description": "Sweet and savory sauces, relishes, spreads, and seasonings", "Picture": { "Length": 10746 } }, { "CategoryID": 3, "CategoryName": "Confections", "Description": "Desserts, candies, and sweet breads", "Picture": { "Length": 10746 } } ]
si je fais value.CategoryName dans le alert, ca m'affiche undefined.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 $(window).ready(function() { $.ajax({ type: "POST", url: "/Project/WebServiceCategories.asmx/GetCategories", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $.each(msg, function(key, value){ alert(value); }) } }) })
Quelqu'un a t-il une solution à m'apporter ?
merci d'avance.
Partager