Flickr Api Call With Xmlhttprequest Not Working
Solution 1:
The Flickr API doesn't support CORS. There is no way to access it directly, from JS embedded in a webpage on a different origin, without using the JSONP API.
Flickr does provide an XML version (remove format=json&callback=?
from the URL) and a plain JSON version (use format=json&nojsoncallback=1
) but without Flickr's granting permission with CORS you can't access it directly. You could use a proxy server (either one on the same origin as your webpage, or one which inserts CORS into the response).
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null.jsbin.com'; is therefore not allowed access. But why I am not getting same error with getJSON
Because jQuery uses the JSONP technique instead XMLHttpRequest when you have callback=?
in the URL.
Post a Comment for "Flickr Api Call With Xmlhttprequest Not Working"