-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using JSONP breaks parsing of return data #27
Comments
I'm getting a 404/notfound error on that link. Can you send me a valid one? Thanks. |
Hi sorry, yes that is on a local test (not public facing/access) basically its only an api that returns the data element (json_encoded) as {"total":"40"} , or another call returns something like {"id":"1","name":"my name","total":"1") ..... which results in same error indicating that the very first : is where a missing ; before statement must be .... how must a custom plugin/ data source be defined (I have one obviously calling these apis) which used types JSON but now I define JSONP (so not sure if a datasource which worked/works with JSON can simply just change type to JSONP (or is there some changes that must be made to handle JSONP ? Thanks |
Oh, I think the problem is that your JSONP file isn't really JSONP. http://en.wikipedia.org/wiki/JSONP. JSONP is actually a script file that must be formatted like javascript and calls back the function passed in the URL. So for that example above, the file would need to look like: jQuery20302740955555920611_1401453890633({ The main thing is that the function name changes randomly so you need to make sure your API endpoint is taking this into account when it creates the JSONP file. |
Good day,
Maybe I missed it in the notes or other questions, but I can not see any mention of the following. To fix CORS, I am using JSONP, but now I am getting errors on the returned data :
Timestamp: 2014/05/30, 14:45:45
Error: SyntaxError: missing ; before statement
Source File: http://www.site.cc/rand?callback=jQuery20302740955555920611_1401453890633&_=1401453890657
Line: 1, Column: 8
Source Code:
{"total":62}
basically indicating that between total and 62 (at the colon) there is a missing ; before statement ?
Worked fine on JSON when running both data and freeboard on same server/site
Thanks for the time and effort.
The text was updated successfully, but these errors were encountered: