Javascript 如何使用jQuery处理Google建议查询
我正在尝试使用GoogleAPI进行建议查询。但是我犯了一个错误 这是我的密码:Javascript 如何使用jQuery处理Google建议查询,javascript,jquery,ajax,google-api,autosuggest,Javascript,Jquery,Ajax,Google Api,Autosuggest,我正在尝试使用GoogleAPI进行建议查询。但是我犯了一个错误 这是我的密码: $.ajax({ url:'http://suggestqueries.google.com/complete/search?client=chrome&q=sheikh+hasina', type:"GET", dataType: 'jsonp', jsonp:function (data) { console.log('yes'); }, async:'true',
$.ajax({
url:'http://suggestqueries.google.com/complete/search?client=chrome&q=sheikh+hasina',
type:"GET",
dataType: 'jsonp',
jsonp:function (data) {
console.log('yes');
},
async:'true',
success:function (data) {
console.log('yes');
},
error: function(jqXHR, textStatus, errorThrown){
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
}
});
假设您正在尝试从URL获取
JSONP
数据,请尝试此方法
$.ajax({
url: 'http://suggestqueries.google.com/complete/search?client=chrome&q=sheikh+hasina',
type: 'GET',
dataType: 'jsonp',
success: function (data) {
console.log(data);
},
error: function(jqXHR, textStatus, errorThrown){
console.log(jqXHR);
console.log(textStatus);
console.log(errorThrown);
}
});
你有什么样的错误?请张贴您的日志。