4 ms·
Naive question - but how could you do any interactions (login, add/edit stuff that talks to a server) without using Javascript?
by bilater 8y ago
Naive question - but how could you do any interactions (login, add/edit stuff that talks to a server) without using Javascript?
- crooked-v 8y agoForm posts to the server, just like the old days. Of course, then you need a full page reload every time you edit something.
- anderspitman 8y agoHyperlinks
- winduptoy 8y agoHey, author here. A lot of things are performed on the server, and then the server responds with a "flash" which is basically a little bar that says "Data saved." or "There was an error: ...". There are a few places where I used a simple 5-liner to validate a field or something. Unfortunately there was one place where I needed some heavier JS (for which I used Mithril.js), but it was absolutely required for when you're editing an invoice. You wouldn't want to edit line items and wait for a server response every time you make one change, so I simply determined that this was an area where I had no choice. Mithril simply modifies the DOM inside the <form> element, and then saving is a plain old POST request when you submit the form after you've made all of your changes. The unfortunate reality is that I couldn't completely free myself from JavaScript, but got a lot closer.
- zanny 8y agoIts generally good practice to start with forms and only start doing fetch requests for things you can demonstrate hamper user experience requiring refreshes.