We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm trying to use a trafiklab.se API. The url im putting into loadJSON() works fine when put into the web browser, but with loadJSON() i get the error:
Script error. 5209: Uncaught TypeError: Cannot read property 'responseText' of undefined
This is the error shown in the node-webkit errorlog of the p5js browser:
Uncaught typeahead.json?key=MYAPIKEY&searchstring=slussen&callback=reqwest_144658152…:1 SyntaxError: Unexpected token : p5.js:5209 Uncaught TypeError: Cannot read property 'responseText' of undefined p5.js:5209 success p5.js:5067 27.script.onload.script.onreadystatechange
And this is the code that loads the json
var url = "http:/ /api.sl.se/api2/typeahead.json?key=MYAPIKEY&searchstring=" + "slussen"; loadJSON(url, platsuppslag, "jsonp");
The syntax error thing made me think that the API response might be wrongly formatted somehow, but according to jsonlint it's all good.
This is only my second attempt at using an API, so I have no idea where to start with this, any help greatly appreciated :)
edit: the forums does something weird with the url, it looks fine in post preview but not in the post itself :S