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.
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025