【发布时间】:2015-01-16 09:41:31
【问题描述】:
我非常了解创建 JSON 对象并将它们传递给浏览器。出于某种原因,我没有让回调工作。控制台上没有任何内容。
$('#id').change(function(){
$.getJSON('ajax.cfm?id='+$(this).val()+'&callback=?',null,function(data){
console.log('here');
});
});
正在调用,它返回 200 状态和 JSON 对象:
configuratorsObj({
"Results" : 8,
"items" : [
{
vchrName: "Name1",
itemID: 1782
},
{
vchrName: "Name2",
itemID: 1769
},
{
vchrName: "Name3",
itemID: 1756
},
{
vchrName: "Name4",
itemID: 404
},
{
vchrName: "Name5",
itemID: 248
},
{
vchrName: "Name6",
itemID: 1743
},
{
vchrName: "Name7",
itemID: 5786
},
{
vchrName: "Name8",
itemID: 469
}
]})
但是回调不起作用,即使只是一个简单的 console.log('here')。控制台上没有错误。
【问题讨论】:
标签: javascript jquery json jsonp getjson