Asynchronous post challenge

You create a website.
It contains 2 text fields, with a single digit number each.

When the user changes the value of a text field, the client transmits the number to a server, asynchronously. No further interaction with the user is required.

As most visitors of the website are mobile users, the client must be able to deal with going offline. When the client comes back online, the values that have not been transmitted so far need to be transmitted.

Optional extra: showing a check mark next to the text field, for successful transmission to the server.

What would be the simplest solution, given you can use only HTML and JavaScript (and JavaScript libraries/frameworks)?

Did you find this post useful? Show some love!

Vanilla JS: use localStorage to keep the values (in order they were typed), and check when connections is online send the events from the queue. (local storage or indexedDB).

Any offline capable framework like Google Firestore, AWS APPSync ....


Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on It literally takes a few seconds and we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

I'm a little confused by the problem being posed. Do you need to give the user a confirmation that the async task finished?

What I meant In the optional extra: give the user confirmation that the server actually received the data.

So sending is one thing and sufficient in terms of the challenge.
Confirmation of reception by the server would be the cherry on top. Does that help?

In more technical terms: setting the check box as a reaction to a HTTP status ok response from the server qualifies for the optional extra.

App cache, service worker, local storage and Ajax call. I would stick to plain JavaScript.

Who’s going to be the heroIne who posts code?

Classic DEV Post from Sep 8 '17

What's your favorite useless repo/package/website/etc?

So I'm trying to remedy my carpal tunnel by considering making the decision to ...

Follow @andy to see more of their posts in your feed.
Bertil Muth
Started with BASIC on a C16, later Assembler on an Amiga 500. Studied computer science. Became consultant for Requirements Engineering and agile development.
More from @bertilmuth
Customize parsing and formatting of dates in Java 8
#java #coding
What are your experiences with "executable specifications" or "living documentation"?
#discuss #coding
Trending on
Does anyone else feel bothered when people term us as coders instead of developers or programmers..?
How to deal with being laid off?
#work #job #development #discuss
Who uses Telegram at work?
Its 2018, why are you still going to the office?
What are your programming blogs?
Postgres or mysql
Who's looking for open source contributors? (June 18 edition)
#discuss #opensource
What are some good questions for a "State of the Web" survey?
#webdev #discuss