我正在取回一些 JSON,需要在我的页面上显示它,但它似乎不会显示!
有人可以看看,看看你能不能看出我哪里出错了?
代码:
$.ajax({ type: "GET",
url: "URL GOES HERE - Cant give for obvious reasons :)",
dataType: "jsonp",
success: function (response) {
var result = response.d;
$.each(result, function (index, res) {
$('#questions').val(res.q);
});
},
error: function (msg) {
}
});
JSON:
{
"d": [
{
"id": "1002 ",
"q": "What region is Auchentoshan whisky made in",
"a1": "Highlands",
"a2": "Speyside",
"a3": "Lowlands"
},
{
"id": "1042 ",
"q": "Chase’s award winning vodka is made from...",
"a1": "Grapes",
"a2": "Rye",
"a3": "Potatoes"
}
]
}