Search code examples
jqueryajaxbox-api

How to call the box APIs with jQuery


I am trying to integrate the Box API to list out my files and folders, I am following the Box documentation http://developers.box.com/oauth/. I am not able to use this with jQuery style.

Can anyone please provide me a hint on how to do this using jQuery/ajax ways.

All comments are most welcome.


Solution

  • What are you trying to integrate the API in? You will run into the Same origin policy, a security standard by common browsers (Chrome, Firefox, ...) if you make requests from the client-side of a webpage.

    That said,

    • the API either has to support JSONP or CORS (which should be documented somewhere) and you have to adapt your requests respectively
    • or fire the requests from your Server-side, which would not be JQuery/ajax, but PHP (e.g. this example) or any other Server script