callback之后報(bào)錯(cuò)
問大神:為什么我加上callback之后報(bào)錯(cuò)SyntaxError: expected expression, got '<' ?代碼和老師的一樣
代碼:<input type="text" id="a" ><input id="b" type="button" value="查詢" >
<div id="main" style="width: 600px;height: 500px;"></div>
<script>
?? ?var token = 'clR7lmWlaguV9WUYKM70GMbj';
?? ?var url = 'http://api.map.baidu.com/geovoder/v2/?output=json&ak=' + token + '&address=';
?? ?var ePlaceInput = $('#a');
?? ?var eSearchBtn = $('#b');
?? ?//var myChart = echarts.init(document.getElementById('main'));
?? ?eSearchBtn.click(function(){
?? ??? ?var place = ePlaceInput.val();
?? ??? ?if(place){
?? ??? ??? ? $.getJSON(url + place +'&callback=?',function(res){
?? ??? ??? ??? ?if(res.status === 0){
?? ??? ??? ??? ?console.log(place,res.result);
?? ??? ??? ??? ?//drawMap(place,res.result.location);
?? ??? ??? ??? ?}else{
?? ??? ??? ??? ??? ?alert('沒有找到地址');
?? ??? ??? ??? ?}
?? ??? ??? ?});
?? ??? ?}
2017-01-12
少了一個(gè)大括號