-
Notifications
You must be signed in to change notification settings - Fork 44
Cross Origin POST Requests
As most developers know it isn't possible to make POST
requests in Javascript to an other domain without having to setup extra headers.
During developing I needed to send some POST
requests to Echonest and Spotify. In both cases the browser returned the CORS error message. Time to start thinking about a solution since I really needed those POST
requests. The result: an extra, online, page.
###How it works
I've again used my online http:/mopify.bitlabs.nl/
page to create POST requests.
This time the solution was a bit easier. Instead of sending a post request to the service, I'm sending a GET
request to my own server which holds the POST
data as query variables. When the http://mopify.bitlabs.nl/api/post/
page is opened it will create a POST
request using CURL
based on the given parameters. The result is then placed on the page surrounded by the callback.
kjhjk