Great question. Ajax relies on JS, so if the user has disabled JS, we are out of luck. That's why it's best to have progressive enhancement: build a "classic", JS-free website, and then use JS to hide those old things and replace them. If JS is disabled, you still have a working site. The reading talked about this.
However, a recent survey showed that 90+ percent of blind people used browsers with JS enabled. So, this is less of a concern than it used to be.
If a request fails, hopefully the browser gets an error response or times out.
Presumably an error of some type. You can set up an ajax error handler. You can also chain a .fail()
handler onto a particular request. See jquery.post
I think you overlooked this code:
app.post('/likeAjax/:tt'calling
likeMovie(tt)and
likeMovie(tt)posting to likeAjax/tt Are they using each other at the same time? How does that work?
My bad. I had a front-end JS function to launch an Ajax request to "like" a movie, and a back-end function to increase the like count in the database, and I called them both likeMovie
. I'll have to come up with new names that make this clearer. Maybe likeMovieViaAjax
and likeMovieInDb
.
The Ajax request gets to respond to the browser. That's where to put the error messages.
You have a big, wrinkley brain. You'll get this.