• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

Dynamic code for Javascript ...

I went with dynamic code instead. Unlike on the server side, it’s a very bad idea to load tons of javascript classes into a browser. I did something to this effect:

var someSQLObj = Class.create();
someSQLObj.prototype = {
objName  : ’someSQLobject’,
errMsg   : ‘Object could not be loaded’,
errMsgUpdate   : ‘Could not update’,
data     : null,
initialize: function(id){
var err = this.errMsg;
this.objName = id;
new Ajax.Request(’/autoclassajax.php?action=getObject&SQLObj=’ + this.objName,
{
method:’get’,
onSuccess: function(transport){
var response = transport.responseJSON || err;
this.loadData(response);
},
onFailure: function(){ alert(err);  }
});
},
loadData : function(data){
this.data = data;
// if the HTTP request is good, it should be the SQL object as a JS object
alert(this.data);
},
getParam(param) {
var prm = ”;
eval(’prm = this.data.’ + param + ‘;’);
return prm;
},
setParam(param) {
eval(’this.data.’ + param + ‘ = prm;’);
},
save: function() {
var err = this.errMsgUpdate;
new Ajax.Request(’/autoclassajax.php?action=setObject&SQLObj=’ + this.objName + ‘&jsonData=’ + escape(Object.toJSON(this.data)),
{
method:’get’,
onSuccess: function(transport){
var response = transport.responseText || “no response text”;
#alert(”Success! ” + response);
},
onFailure: function(){ alert(err);  }
});
},
};

Roughly anyway.  At any rate, I have reduced the SQL generator robot to only generate PHP classes and connector bindings, then I am loading the objects into JS dynamically, and producing the client side div.innerHTML code on the fly. The less Javascript code the better. It’s a performance issue.

 Original Source:

AddThis Social Bookmark Button

Posted at 11:45:49 am | Permalink | Posted in Javascript  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Top Stuff

MessengerFX

e-messenger

ILoveIM

Top 20 Ruby CMS

eBuddy

MSN Web Messenger



About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Search


Topics

  • .Net (164)
  • Ajax (83)
  • Ajax Games (10)
  • Articles (95)
  • Bookmarking (35)
  • Calendar (20)
  • Chat (45)
  • ColdFusion (3)
  • CSS (75)
  • Email (23)
  • Facebook (83)
  • Flash (19)
  • Google (54)
  • Html (27)
  • Image (11)
  • International Calls & VOIP (7)
  • Java (54)
  • Javascript (266)
  • jQuery (159)
  • JSON (61)
  • Perl (2)
  • PHP (156)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (8)
  • Ruby (31)
  • Storage (4)
  • Toolkits (103)
  • Tutorials (217)
  • UI (11)
  • Utilities (174)
  • Web2.0 (18)
  • XmlHttpRequest (28)
  • YUI (12)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange