should I use javascript to update database or do a form button?

Posted 2 weeks ago by michalis

I have a download link and I track how many times its downloaded, the number is displayed next to the download link

when the link is clicked, should I use javascript/ajax to change it in the database and refresh the view?

or should I do something like a form button, which when clicked sends a patch request, then the method updates the db, calls the function to start the file download and redirects to the previous page?

which would be the simpler and more elegant way? is there a way im not thinking of?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.