跟著老師做的為什么沒有下拉框?????求大神解答下
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script>
$("#qqqq").bind('keyup',function(){
var mmm=$('#qqqq').val();
?$.get('http://api.bing.com/qsonhs.aspx?q='+mmm,function(d){
? ?var d=d.AS.Results[0].Suggests;
? ?var html='';
? ?for(var i=0;i<d.length;i++){
? ?html+='<li>'+d[i].Txt+'</li>';
? ?}
? ?$('#ssss').html(html);
? ?$("#gogo").show().css({
? top:$('#aaa').offset().top+$('#aaa').height()+50,
? left:$('#aaa').offset().left+50,
? position:'absolute'
? });
?},'json');
??
})
$(document).bind('click',function(){
? $('#gogo').hide();
})
</script>
然后在控制臺開到的是這樣的
Failed to load http://api.bing.com/qsonhs.aspx?q=: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
2019-07-05
你ajax請求的datatype的值設為jsonp就可以解決跨域
2019-07-05
跨域了啊