this code:
$.ajax({
url: "https://blahblah.co/api/agentinbarcode",
method: "POST",
data: {
agentId: 6,
city:'-',
barcodeSerial:'HID9904000015',
lat:141,
lon:256
},
success: function (response) {
console.log(JSON.parse(response))
},
error: function (response) {
console.log(response)
}
});
response diffrently from this:
var datttaaaa ={ barcodeSerial: 'HID9904000015',
lat:141,
lon: 256,
city:"-",
agentId:6}
fetch('https://blahblah.co/api/agentinbarcode', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: JSON.stringify(datttaaaa),
}).then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
})
.catch((error) => {
console.error(error);
});
the response of both must be 'this id has already been sent' which $.ajax perfectly does it and correct but the Fetch api returns "this id do not exist in the site"
are these two one and same? same URl same Data if it's not what is my problem?