I recently utilized a REST API to send a POST request. Upon clicking on the function addmode()
, a textbox is displayed allowing users to input data. However, upon clicking the save()
button, an unexpected error occurs and redirects to a PUT
Request.
Using Angular Js:
$scope.addmode = function(information) {
var postinfo = information;
$http({
url:'http://localhost:3000/contacts' ,
method : 'POST',
data : postinfo
})
.then(
function successCallback(response) {
$scope.selectedcontact = '';
console.log(response.data)
},
function errorCallback(response) {
console.log("Error : " + response.data);
});
};