Possible Duplicate:
json Uncaught SyntaxError: Unexpected token :
Does jsonp depend on server support, in order to return a correct response?
I got this request, and what I get back is js error.
$.getJSON('myURL?q=keyword&callback=?', function(data){console.log(data)});
even angular jsonp method isn't working:
http://jsfiddle.net/neoswf/tckGG/5/
console >> js error: Uncaught SyntaxError: Unexpected token :
Does jsonp depends on some server implementations?
SOLVED!!!
This question is different from others cause no other answers speak about the proxy solution.
The server doesn't return JSONP, it returns JSON. A JSONP result is a JSON result wrapped in a function call.
Example:
callback873659823745({"destino":"http://...", ... })
If you can't make the server return JSONP, you would need a proxy server that requests the service and returns the JSON result wrapped as a JSONP result.
As it happens, I set up such a proxy a while ago, at jsonp.guffa.com, that you could use if you don't have the ability to set up one yourself.
Yes, jsonp requires server support. The server needs to wrap the json in the "padding" part of the json*P*, which is a method that the client defines and executes around the response data.
Because your Url isn't returning JSONP. It is returning JSON.
{"destino":"http://www.buscape.com.br","palavras":["tv lcd 32","tv led","tv led 32","tv led 40","tv","tv led 42","tv lcd","tv lcd 42","tv lcd 26","tv 3d","tv lcd 40","tv 32","tv led 46","tv 42","tv lcd 22","tv led 32 full hd"]}
For an example if JSONP, check the return value from flickr. It returns
callbackToExecute({... JSON Object ...})