AJAX 调用返回的数据格式如下
{
"items" : {
"Phones" : "PhoneSelect",
"NoteBooks" : "notebookSelect",
"Tablets" : ""
},
"title" : "What would you like to purchase?",
"defaultText" : "Choose a product category"
}
AJAX 调用
function fetchSelect (val) {
$.getJSON('ajax.php', {key:val}, function(r) {
$.each(r.items, function (k, v) {
根据 jQuery 规范.getJSON
$.ajax({
url: url,
dataType: 'json',
data: data,
success: callback
});
我的问题是
{key:val}
从通话中返回的数据,然后r
里面是什么function(r)
?我看到函数 pass in
val
,但关键值是什么{key:val}