Flask-Web-App-Tutorial
Flask-Web-App-Tutorial copied to clipboard
Items do not delete but rather add new items upon refresh
After adding a note and then trying to delete that note, nothing happens. When the page is reloaded manually, a duplicate of the previous note gets added. This occurred right after cloning the repo and running through vs code.
hey maybe im late but i'll reply anyway... My mistake was that i wrote inClick instead of onClick in "home.html" . There were no other errors for me
hi, my notes are not getting deleted, i tried copy pasting the original code, still its not working
Are you getting any error or notes just not getting deleted?
there is no error or any request sent, the button itself is not working
is there any way i can give access to my private repository and you try to run it? I'm new here
you can give me access as a collaborator, but if u can figure out what is different in yours that would be easier
hey! thanks for that, i got it working somehow, didn't change anything, and i can't figure out what went wrong
Bro I'm having the same error and I need help :(((
Same issue
I found the mistake that I made. There was this piece of code in the base.html that I had neglected to write:
{% block javascript %} {% endblock %}
See if you made the same mistake I did.
Hi. I had the same issue as well. Make sure that the index.js is properly linked with the base.html file. In the video, he has not written the code of index.js in the base.htm which you can see in this repo. Also make sure that the block code looks something like this {% blockinfo %} and not anything else. The spaces are important. Pasting my base.html as that might help. @Gabrango @CODER6GC
{% block javascript %}
<script type="text/javascript">
function deleteNote(noteId) {
fetch('/delete-node', {
method: 'POST',
body: JSON.stringify({ noteId: noteId }),
}).then((_res) => {
window.location.href = "/";
});
}
{% endblock %}
This has to be at the bottom. Hope this helps!!
The issue I was facing was in the base.html file, I did not write the code linking the JS code in this file
{% block javascript %}
{% endblock %}
Write this code in the end and hopefully it works for you as well