Answer the question
In order to leave comments, you need to log in
Help,Make Post request(fetch)?
http://localhost:54316/Account/Register?role=Order...
in POSTMAN correctly adds to the database, but if the link is put in React Native, an error
fetch('http://localhost:54316/Account/Register',{
method: "POST",
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
role:"Заказчик",
UserName:"Postks",
PhoneNumber:"+16774521547",
Password:"ssss",
PasswordConfirm:"ssss*",
}),
})
.then(function(response){
return response.json();
})
Answer the question
In order to leave comments, you need to log in
function but(id) {
fetch('/ajax', {method: 'POST',body:JSON.stringify({
name:'vlad',
id:id
}),headers:{'content-type': 'application/json'}})
.then(function (response) {
alert(response.status); // 200
return response.json();
})
.then(function (data) {
alert(data.id);
let elem = document.getElementById('h2o');
elem.innerText = data.id;
})
.catch(alert);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question