jsonp跨域改写
$.ajax({
type:'get',
crossDomain:true,
url:'http://api.bing.com/qsonhs.aspx?q='+searchText,
dataType:'jsonp',
async:true,
success:function(data){
var date=data.AS.Results[0].Suggests;
console.log(date);
var html='';
for (var i = 0; i<date.length; i++) {
html+= '<li>'+date[i].Txt+'</li>';
}
$('#search-result').html(html);
$('#search-suggest').show().css({
top:$("#search-form").offset().top+$("#search-form").height()+10,
left:$("#search-form").offset().left,
position: 'absolute'});
}
})
用jsonp跨域还是不能显示出来,不过data信息能获取了,这是为什么?