O'Reilly logo

jQuery Essentials by Troy Miles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using events to decouple code

Through this book, we have used events, but they have always been triggered by jQuery or the browser but never by us. Now, that is about to change. Events are really great for the decoupling of code. Imagine a scenario where you and another developer are working together on an application. The other developer is going to supply your code with data. This data—let's call it the data source—will be available intermittently, unlike the previous example of supplying the data via a single Ajax call. Your code, the data reader, will render the data to the page when it becomes available. There are several ways that we could go about this.

The data source could provide a polling method for us to call. We would repeatedly call ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required