Using JQuery to get JSON from Flask is returning null sometimes
So i fixed the issue after like a week of digging. Looks like my requests were getting cancelled before returning back to the webpage. So what i did was a e.preventDefault() in my JavaScript function.
so in my html i change it to
<form onsubmit="restoreDB(event)">
and in my JavaScript i added this
function restoreDB(e) {
e.preventDefault();
Now the webpage doesn’t reload and it has enough time to wait for a response. Probably not the best fix but I am just happy I fixed it. If anyone recommends anything better, that will be great
Read more here: Source link