Archive | March 2009

Dynamically loading javascript files

Below is a little piece of code that helped us facilitate dynamically loading javascript files.

// Please go here for details on the script below:
var head = document.getElementsByTagName("head")[0];
var script = document.createElement('script');
script.setAttribute("id", id);
script.setAttribute("type", 'text/javascript');
script.setAttribute("src", url);
script.onload = function(){
   loadedCallback(sender, id);
script.onreadystatechange = function(){
   if (this.readyState == 'loaded' || this.readyState == 'complete') {
      loadedCallback(sender, id);

As you can see the same callback loadedCallback(sender, id); is called twice. The first under the load function is only picked up by Firefox, Opera, etc. and the onreadystatechange is a Microsoft event. Took me forever to figure the Microsoft solution.


Been way too busy

I have been way to busy this month to post anything. The latest project that I have been put on is an upgrade of an existing Progress/OpenEdge application. The current application is so tightly integrated with the database that is close to impossible to create a web-based application with the current code.

Therefore we are moving forward with an inhouse back-end solution that will expose the Data Access throught JsonRPC calls. The front end is not .NET, but a complete Javascript solution. All calls to the data access and between screens will all be done via AJAX callbacks. The framework we decided to use is one supplied by (Isomorphic). The architecture is as close to a 100% object oriented javascript solution that you can get.

It works pretty well but we only decided to use the free front end solution and chose not to purchase the java server side portion of the application. That hindered us tremendously, because all the scalability that Isomorphic gave us just got thrown out the window. So what next?

Well, we are investigating a way to integrate the PureMVC javascript model into this Isomorphic framework. I have spent a couple of days so far on it and I think we are close. I will keep you updated.