Here is the code snippet I tried:
fetch('http://localhost:3000', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
'size': 'size_id',
'style': 'style_id',
'qty': '1'
})
})
.then(res => {
console.log(res)
});
I am facing an issue where I only get 'Promise pending' as the return value. I am a beginner in using fetch and fairly new to JavaScript, so any guidance would be greatly appreciated.