Created
November 21, 2016 09:48
-
-
Save rubinchyk/79bc8eb1bcd861078027c7dfa999058c to your computer and use it in GitHub Desktop.
Angular1: Send POST request with regular 'post'
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
var req = { | |
method: 'POST', | |
url: 'http://', | |
headers: {'Content-Type': 'application/x-www-form-urlencoded'}, | |
transformRequest: function(obj) { | |
var str = []; | |
for(var p in obj) | |
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | |
return str.join("&"); | |
}, | |
data: { | |
info: info | |
} | |
} | |
$http(req).then(function(ev){ | |
console.log('Success'); | |
}, function(error){ | |
alert('Not success!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment