May 2017
— Yeah. I figure it saves the server a little bit of time.
I would simply do the first method since it reduces complexity, you can send a urlencoded form with little configuration
— It is also a flat object with little room for malformed structure
— Ok.
— How could I send data back to the client without refreshing?
— An XHR
— (ajax)
— You can either turn the button element into a div instead, then addEventListener to an XMLHttpRequest
div
addEventListener
Message permanent page
— Or call preventDefault on the button, while doing the former
preventDefault
— Ok
— Https://hastebin.com/dojulatepo.js
— This is a snippet I use a lot