App reviews, troubleshooting, and recommendations
Hi
I am working on some custom code and found when i am making ajax post call it gives 404 error
Need to call this section and get data is my primary concern.
simple ajax with post call gives 404 error though website page/section is working perfectly.
Error: https://prnt.sc/59wqwAGtBopm
Working url: https://theearthbands.com/?sections=johntest
Below is demo code which is not working it is as simple as to work so that i can apply my logic to others
const endpointUrl = '/?sections=johntest';
const apiKey = 'key added'; // Replace with your actual API key
$('#calculatorForm').on('click', function() {
const dataToSend = {
key1: 'value1',
key2: 'value2'
};
fetch(endpointUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}` // Include the authorization header
},
body: JSON.stringify(dataToSend)
})
.then(response => response.json())
.then(responseData => {
console.log('Response:', responseData);
})
.catch(error => {
console.error('Error:', error);
});
});
Help is much appreciated
Section rendering API does not require authorization and you can't pass any data, so there is no need to POST.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024