Last active
August 29, 2015 14:05
-
-
Save blotto/2f8c546916b6c49320aa to your computer and use it in GitHub Desktop.
IronMQ example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function postTerm(term) { | |
var xhr = new XMLHttpRequest(); | |
xhr.withCredentials = true; | |
var data = { | |
"messages": [ | |
{ | |
"body": term | |
} | |
] | |
}; | |
xhr.open("POST", "http://"+ironIO.config.host+".iron.io/"+ironIO.config.api_version+"/projects/"+ | |
ironIO.config.project_id+"/queues/"+ironIO.config.term_queue_name+"/messages", true) | |
console.log(data); | |
//Send the proper header information along with the request | |
xhr.setRequestHeader("Content-type", "application/json"); | |
xhr.setRequestHeader("Authorization", "OAuth "+ironIO.config.token); | |
xhr.send(JSON.stringify(data)); //and forget | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment