修改jsonp跨域后, d.AS.Results is undefined
bing search
*{padding: 0;margin: 0}
ul{list-style: none;}
body{background: #333;}
.bg-div{background-image: url(images/river.jpg);width:1228px;height:690px;margin:0 auto;position: relative;}
.logo{margin:-4px 18px 0 0;background-image: url(images/logo.png); width:107px;height: 53px;float: left}
form{float: left;background-color: #fff;padding: 5px;}
.search-input-text{border:0;float: left;width:350px;height: 25px;line-height: 25px;outline: none;}
.search-input-button{border:0;background-image: url(images/search-button.png);width: 29px;height: 29px;border:0;float: left;}
.search-box{position: absolute;top:200px;left:300px;}
.suggest{width: 388px;background: #fff;border:1px solid #999;}
.suggest ul li{padding: 3px;font-size: 14px;line-height: 25px;cursor: pointer;}
.suggest ul li:hover{text-decoration: underline;background-color: #e5e5e5;}
<script>
$(document).ready(function(){
$('#search-input').bind('keyup',function(){
var searchText=$('#search-input').val();
$.ajax({
url:'http://api.bing.com/qsonhs.aspx?type=cb&cb=cab&q='+searchText,
dataType:'jsonp',
jsonp:'cb',
jsonpCallback:'cab',
success:function(d){
var d=d.AS.Results[0].Suggests;
var html='';
for(var i=0;i |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|
前端跨域有点扯淡啊,这活还是让后端去做吧,好端好弄些 |
|
|
|
|