O'Reilly logo

Web Design Blueprints by Benjamin LaGrone

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

Creating a callBack function for the API

The final piece in making this and the other local JavaScript work through the routing table is to wire it into the services.getPage function. This will be easy.

Using the callBack function

Before that, we first need to write a new callBack function to do something with the JavaScript that is in the content directories. And when it loads it, it loads into the header's SCRIPT element, where it runs. Create a new function as a method of the services.routing object called writeScript. It will receive the variables XHTTP, id, and hash.

services.routing.writeScript = function(xhttp,id,hash){
//Do Something
};

Inside it, first create a new variable called newScript equal to the document's createElement method, creating ...

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