I'm trying to use the following to get metadata from Worldcat about some books:
$.getJSON( " http://xisbn.worldcat.org/webservices/xid/isbn/" + $isbn[1] + "?method=getMetadata&format=json&callback=mymethod&fl=*");
Where $isbn[1] is a ten or thirteen digit number (0123456789 works).
I can put http://xisbn.worldcat.org/webservices/xid/isbn/0123456789?method=getMetadata&format=json&callback=mymethod&fl=* and I get the results I need, but I'm not crossing domains to do that.
The console is reporting XMLHttpRequest cannot load http://xisbn.worldcat.org/webservices/xid/isbn/0123456789?method=getMetadata&format=json&callback=mymethod&fl=*. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.
I am doing all this on jsfiddle. Thinking maybe that could be the problem I tried locally, but no difference. What am I doing wrong?
I wasn't following the API documentation properly and put the success handler's name in the URL, rather than sending it as the data parameter.
I had:
$.getJSON( "http://example.com?method=getMetadata&format=json&callback=mymethod&fl=*");
But it should have been:
$.getJSON( "http:/example.com?method=getMetadata&format=json&fl=*&callback=?", mymethod);