This script tests the threadsafety of cpaint2.
While AJAX is built from the ground up to be able to handle asynchronous request / response pairs, this doesn't mean that the application frontend that uses AJAX can handle situations where multiple open requests exist at the same time.
When clicking on the button below the current system time is retrieved from the backend twenty times in fast succession. The backend is configured to respond with a random delay of several seconds. After clicking this button you will see the effect: The times shown as response might not be in chronological order but yet all responses will appear after some time.