Created
August 6, 2014 20:19
-
-
Save thoughtpalette/47ba20ab022e49a4443e to your computer and use it in GitHub Desktop.
Twilio API jQuery Post
This file contains hidden or 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
// Had issues with CORS when implementing different post types and changing headers in node/express/angular.$http, this works even though it still gives me the CORS error. | |
$.ajax({ | |
type: "POST", | |
username: "[ACCOUNT_SID]", | |
password: "[AUTH_TOKEN]", | |
url: "https://api.twilio.com/2010-04-01/Accounts/[SID_HERE]/SMS/Messages", | |
xhrFields: { | |
withCredentials: true | |
}, | |
data: { | |
"To" : "+1312******", | |
"From" : "+1********", | |
"Body" : "your message" | |
}, | |
success: function(data) { | |
console.log(data); | |
}, | |
error: function(data) { | |
console.log(data); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment