Dynamically Loading jQuery plugins
In previous iterations of Dovetail Agent, there have been jQuery plugins (i.e. spellCheck) that could potentially be used on any page in the web application, so each file containing the jQuery plugin code actually included on every page so the plugin would always be available for use.
This was accomplished with a server-side include file, and doing a Response.Write method for each included file:
This serves its purpose well, but the downside is that only a small percentage of the pages actually need the plugin. A slight change to the mechanics of including the files allows the plugin to be available only when required.
First, the Response.Write is removed from the server-side include file. Next, some new code gets added to the client-side page that handles usage of the plugin: