Topic: register event

I believe that simple is best.
I just use only  $objResponse->addScript($sScript), never other member funcs.

for example:

function init(){
  xajax_loadProjectIdList();
}

function onLoadProjectIdListSucc(idList){
  //idList is a private defined string.  we can call it protocol??
  //idList is like: "projectId1:projectId2:projectId3:..."
 
  //split idList and fill a <select> element with id list
  //choose the default value
  //call xajax_loadProjectInfo(projectId), another xajax function, to load project info and fill the panel.
}

function onLoadProjectIdListFail(reason){
  //just alert(reason) to tell user
}

on server php, function loadProjectIdList read project id list from DB.
if succ,

$objResponse->addScript("onLoadProjectIdListSucc('1:2:3:4');");

if failed,

$objResponse->addScript("onLoadProjectIdListFail('failed reason, may be DB connect error.');");

when call xajax_doSomeThing, scripts that $objResponse can added limited as follow:
1. onDoSomeThingSucc
2. onDoSomeThingFail
3. serverDebug
4. serverReport

I can't register event like
onDoSomeThingConnectError
onDoSomeThingConnectTimeout

maybe when new Xajax(),  i can register these event. although it is enough with onDoSomeThingSucc and onDoSomeThingFail.

@ @
  L______________eon.Z
   |                     |
  / \                   / \