How will I access this data in javascript?
[
{
"itemData": [
{
"Key": "218",
"Value": "اسلامشهر"
},
{
"Key": "219",
"Value": " بهارستان"
},
{
"Key": "220",
"Value": " پاكدشت"
},
{
"Key": "221",
"Value": " پرديس"
},
{
"Key": "222",
"Value": " پيشوا"
},
{
"Key": "223",
"Value": " تهران"
},
{
"Key": "224",
"Value": " دماوند"
},
{
"Key": "225",
"Value": " رباط كريم"
},
{
"Key": "226",
"Value": " ري"
},
{
"Key": "227",
"Value": " شميرانات"
},
{
"Key": "228",
"Value": " شهريار"
},
{
"Key": "229",
"Value": " فيروز كوه"
},
{
"Key": "230",
"Value": " قدس"
},
{
"Key": "231",
"Value": " قرچك"
},
{
"Key": "232",
"Value": " ملارد"
},
{
"Key": "233",
"Value": " ورامين"
}
]
}
]
I used AJAX in JSON format. I tried access JSON like:
success: function (data) {
$.each(data.d[0].itemData, function (index, element) {
alert( data.d[0].itemData[index].key);
})
}
but not getting output.