May 2017
Intermediate to advanced
448 pages
10h 10m
English
Right now, our dictionary doesn't show any definitions on the initial page load. Instead, it just shows some empty space. Let's change that by showing the "A" entries when the document is ready. How do we do this?
One approach is to simply add the load('a.html') call into our document ready handler ($(() => {})) along with everything else. The problem is that this is inefficient because we have to wait for the document to be ready before we can even make the Ajax request. Wouldn't it be better to make the Ajax request as soon as our JavaScript runs?
The challenge is then synchronizing the document ready event with the Ajax response ready event. There is a race condition here because we don't know which event ...
Read now
Unlock full access