简体   繁体   中英

jQuery and Yahoo API parse error / unexpected token

this is my simple function

function searchCity(val) { 

    vurl= "http://where.yahooapis.com/geocode?q=" + val + "&flags=J&appid=[my app id here]&callback=?";
    $.getJSON(vurl, function(data){ 
   console.log(data);
    });

}

as you see is pretty simple... but i always receive an error in my console that reads

Uncaught SyntaxError: Unexpected token :

i never had problem with google apis...do Yahoo require some of their libraries?

The JSON parser is choking... perhaps the result from Yahoo isn't formatted as JSON? See if there is a parameter in the URL that specifies a JSON result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM