I get this error when i click on a button it sends json data to the server and does an sql search the sql results are then sent back to the client side when it is then added to the HTML the issue i am getting is when i click on the button it only runs if i click 2 times otherwise i get an empty string. How can i reslove this
The other issue is that the button click will stop working after a few clicks and will stop returning the data from the .fetch and will only work if i reload the page and if i stop the node server and run it again i will get [] empty arrays in the console instead of the value
fetch('/exercisechange',configObj)
.then(function(response) {
return response.json();
})
.then(function(object) {
console.log(object);
});
fetch('api/workout')
.then(response => response.json())
.then(data =>{
this is apart of the code on the client side the first used to send the JSON file to the server and the second fetch will put data on the server
I use app.post to retrieve from sql and an async app.get to send back to client side
Thanks