callback之后报错
问大神:为什么我加上callback之后报错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('没有找到地址');
}
});
}