CUDO={ univID:34, year:2017, outputTable:function(container,tableID,year) { var y = (year===undefined) ? this.year : year; var o=new __JSONscriptRequest('http://cudo.ouac.on.ca/api/get-data.php?univ='+this.univID+'&table='+tableID+'&year='+y+'&script=1&container='+container); o.buildScriptTag(); o.addScriptTag(); } } // Constructor -- pass a REST request URL to the constructor // function __JSONscriptRequest(fullUrl) { // REST request path this.fullUrl = fullUrl; // Keep IE from caching requests this.noCacheIE = '&noCacheIE=' + (new Date()).getTime(); // Get the DOM location to put the script tag this.headLoc = document.getElementsByTagName("head").item(0); // Generate a unique script tag id this.scriptId = 'YJscriptId' + __JSONscriptRequest.scriptCounter++; } // Static script ID counter __JSONscriptRequest.scriptCounter = 1; // buildScriptTag method // __JSONscriptRequest.prototype.buildScriptTag = function () { // Create the script tag this.scriptObj = document.createElement("script"); // Add script object attributes this.scriptObj.setAttribute("type", "text/javascript"); this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE); this.scriptObj.setAttribute("id", this.scriptId); } // removeScriptTag method // __JSONscriptRequest.prototype.removeScriptTag = function () { // Destroy the script tag this.headLoc.removeChild(this.scriptObj); } // addScriptTag method // __JSONscriptRequest.prototype.addScriptTag = function () { // Create the script tag this.headLoc.appendChild(this.scriptObj); }