Hi All,
New to Polymer (and fairly new to web development if i'm honest). I'm trying to build a component to connect and manage the Big Stock Photo api.
Heres the api call
and for JSONP
However i'm having a heap of problems trying to get this to work.
1) Heres my iron-jsonp-library attempt
it appears to work fine until the query contains space characters, at which point I get the following error message
e.g Searching "blue background" error begins happening as soon as i hit the space character
Uncaught SyntaxError: Unexpected identifier
?callback=http___api_bigstockphoto_com_2_<account id>_search__callback___callback___q_blue background_api…:1 Uncaught SyntaxError: Unexpected identifier
It appears to be due to adding spaces into the callback method name.
2) My iron-ajax attempt failed due to 'No Access-Control-Allow-Origin' headers not being present
3) Searching google for "iron ajax Access-Control-Allow-Origin" led me to this link:
Which discussed using the byutv-jsonp element like so :
But now i get a weird error message and it spits out a url like this (search "blue background")
GET
http://api.bigstockphoto.com/2/<account id>/search/?0=%22&1=q&2=%22&3=%20&4=%3A&5…0=e&11=%20&12=b&13=a&14=c&15=k&16=g&17=r&18=o&19=u&20=n&21=d&22=%22&23=%7D
I'm not sure how to proceed and I don't know enough about polymer or jsonp to know the best way to handle this.
Any help would be greatly appreciated.