1

Please see this solution. I have a similar error. But I didnt understand the first comment under 1st solution in it which says

Thanks John. If I take the same code and point it to http://api.wunderground.com/api/8ac447ee36aa2505/geolookup/conditions/q/IA/Cedar_Rapids.json' then the response does have the jQueryxxxx() wrapped around the json data, the code runs fine, and I get the 'Success' alert. I can't change the way the remote server serves up the JSON file. If I use dataType: 'json' then I get XMLHttpRequest cannot load isohunt.com/js/json.php?ihq=test. Origin localhost:8888 is not allowed by Access-Control-Allow-Origin

How to make the code point to the url he mentioned and how does this solve the problem? Any help would be appreciated. BTW, mine is a localhost url. I am working with retrieving data from elasticsearch and drawing google charts.

Community
  • 1
  • 1
Kalyanam Rajashree
  • 652
  • 2
  • 11
  • 23
  • Are you using JSONP? `Uncaught SyntaxError: Unexpected token` is a general error telling you that your JSON parse didn't work (probably because the HTTP response was not JSON. – Davin Tryon Sep 20 '16 at 10:18
  • Yes I am using jsonp. Else if I use json, it is giving me error similar to this - If I use dataType: 'json' then I get XMLHttpRequest cannot load isohunt.com/js/json.php?ihq=test. Origin localhost:8888 is not allowed by Access-Control-Allow-Origin (Referring from the link I mentioned in my question). – Kalyanam Rajashree Sep 20 '16 at 18:42
  • My basic idea is to draw a sankey diagram using data from elasticsearch query. I have data uploaded to elasticsearch. I am keeping this code as reference - http://pastebin.com/urjP8L6t . Any help would be appreciated. So, basically how do I check if json parse happened properly ? – Kalyanam Rajashree Sep 20 '16 at 18:49
  • I am also keeping this code as my reference - http://pastebin.com/uT0BTE4d . This error I was getting for this code. – Kalyanam Rajashree Sep 20 '16 at 18:57

0 Answers0