To Do List Project: Part 4

The five states and four transitions in the AJAX process are:

  1. request not initialized
  2. server connection established
  3. request received
  4. processing request
  5. request finished and response is ready

If we don’t care about trying to trap process errors, assume we’ll always get to state 4, and don’t implement a timeout we can change the code from last time so it only updates when the process completes:

This way we only do something when the process completes. Note that setting up the End button only happens if and when a successful AJAX operation is completed. If the two lines were left at the bottom of the function there could be timing issues, so one has to be mindful of the asynchronous nature of the operations at all times.

This entry was posted in Software and tagged , , . Bookmark the permalink.

Leave a Reply