Cannot read property '0' of undefined
<script type="text/javascript">
$(window).on('load',function(){
var suggest = $('.suggest'),
sugval = suggest.val(),
text = $('.text');
$('.text').on("keyup",function(){
$.get('http://api.bing.com/qsonhs.aspx?q='+sugval,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>'
}
$("#search-result").html(html);
suggest.show();
},'json')
})
$(document).on('click',function(){
suggest.hide()
})
})
</script>
跟着老师马的 咋会出现那错误呢