Skip to content

Instantly share code, notes, and snippets.

@tanerochris
Created November 12, 2016 17:07
Show Gist options
  • Save tanerochris/f57751ec0b0717944e9edf42f2d4cf09 to your computer and use it in GitHub Desktop.
Save tanerochris/f57751ec0b0717944e9edf42f2d4cf09 to your computer and use it in GitHub Desktop.
click a tell CORS problem
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
</head>
<body ng-app="myApp">
<button ng-click="click()">Send Message</button>
<script type="text/javascript">
angular.module("myApp",[]).controller("testCntr",function($scope,$http){
var authorization = "Bearer "+ "zu.5_21RmO1Sl5h1RRiGDZVEy.tjD8D5u9UneijpFBeMTrNE7SI990wfrLSR6pT6kD9fLG0vww3eBs";
$scope.click = function(){
var message = {
"text" : "1235",
"to":["***********"]//replace *** with numbers
};
$http.post('https://api.clickatell.com/rest/message',message,{
"headers":{
"Authorization" :authorization
}
}).then(function(response){
console.log(response);
},function(httpError){
console.log(httpError);
});
}
</script>
</body>
</html>
});
@tanerochris
Copy link
Author

tanerochris commented Nov 12, 2016

here is warning
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.clickatell.com/rest/message. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment