You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
820 B
JavaScript
38 lines
820 B
JavaScript
const request = document.getElementById('request');
|
|
|
|
|
|
let dataSend = JSON.stringify({
|
|
data: [
|
|
{
|
|
kodesc: '0535',
|
|
faktur: 'FJDEMO230800001',
|
|
lunas: 25000,
|
|
tgl: '2023-08-31'
|
|
}
|
|
,{
|
|
kodesc: '0535',
|
|
faktur: 'FJDEMO230800002',
|
|
lunas: 50000,
|
|
tgl: '2023-08-31'
|
|
}
|
|
]
|
|
})
|
|
|
|
request.onclick = function(){
|
|
|
|
var url = 'https://www.warpekamart.com/backoffice/api-konsumsi';
|
|
var formData = new FormData();
|
|
formData.append('datapost', dataSend);
|
|
|
|
fetch(url, { method: 'POST', body: formData })
|
|
.then(function (response) {
|
|
return response.text();
|
|
})
|
|
.then(function (body) {
|
|
console.log(body);
|
|
})
|
|
.catch(function(err){
|
|
console.log(err);
|
|
});
|
|
|
|
} |