fetch("http://ahihi.com/process.php", {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded', // <-- content-type="" p="" specifying="" the=""> }),
body: "param1=value1¶m2=value2" // <-- c="" d="" encodeuricomponent="" i="" ng="" p="" parameters="" ph="" post="" th="">})
.then((response) => response.text())
.then((responseText) => {
alert(responseText);
})
.catch((error) => {
console.error(error);
});
fetch("http://ahihi.com/process02.php", {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded', // <-- content-type="" p="" specifying="" the=""> }),
body: "param1=value1¶m2=value2" // <-- p="" parameters="" post="">})
.then((response) => response.json())
.then((responseJson) => {
alert(responseJson.message);
})
.catch((error) => {
console.error(error);
});-->-->-->-->
Title:
Post data dạng key value trong fetch React Native
Description:
Đéo thích post JSON, post dạng key value thì làm thế nào?
...
Rating:
4