I have this piece of code:
[...]
var apiURL = "http://.../api.php?format=json";
$.getJSON(apiURL, function(jsonData) {
$('#tr<?php echo $itemId; ?>').text( $(jsonData)[0].query.pages. + objId );
});
[...]
Where objId is a javascript variable that can handle different values. How can I make this working? How can I add a variable to this json query?
The json is this one:
{
"query": {
"pages": {
"6": {
"pageid": 6,
"ns": 0,
"title": ".ODk.MTc5",
"touched": "2013-05-03T10:22:37Z",
"lastrevid": 26,
"counter": 0,
"length": 23,
"new": "",
"protection": [{
"type": "edit",
"level": "sysop",
"expiry": "infinity"
}
]
}
}
}
}
Thanks!
$?jsonData["query"]["pages"][objId]orjsonData.query.pages[objId]