source code when I POST data from postman it shows an correct response data, but when i POST data using app(client) side it shows an Failed to load http://localhost:3000/done: Response for preflight has invalid HTTP status code 404
1 Answer
At the time of data posting, your local server (means backend server should be on), and post the data through, Header,queryparam or body,
and make sure that same params, you are recieving at backend side,
$http.post('http://localhost:9191/api/signin', {
username: 'some username',
password: 'some password'
}, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'key': '123'
}
})
.then(function(response) {
console.log(response)
});
And don't use json.stringify for data object, now send only object.
5 Comments
Ajith mohan
all set in correct way.bt it shows an preflight response
Kunvar Singh
can you share the code with us??
Ajith mohan
yes,i added that
Kunvar Singh
make sure that, you write the "application/json"
Kunvar Singh
check that, i have added the code for you.