O'Reilly logo

jQuery Design Patterns by Thodoris Greasidis

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

Retrieving HTML templates asynchronously

The final step to mastering client-side templating is a development practice that allows us to load templates dynamically and use them in a web page that has already been loaded. This approach can lead to more scalable implementations than the approach of embedding all the available templates as <script> tags inside the HTML source of each page.

The key element of this technique is to load each template only when it is required for the presentation of a web page, commonly after a user action. The main benefits of this approach are that:

  • The initial page load time is reduced since the HTML of the page is smaller. The gains from the reduction of the page size become even greater if our application has a lot ...

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