var rsp = $decodefn(this.r.responseText); /* the response from perl */
var splitval = '__pjx__'; /* to split text */
/* fix IE problems with undef values in an Array getting squashed*/
- rsp = rsp.replace(splitval+splitval+'g',splitval+" "+splitval);
+ rsp = rsp.replace(new RegExp(splitval+splitval, "g"),splitval+" "+splitval);
var data = rsp.split(splitval);
dt = this.target;
if (dt.constructor != Array) { dt=[dt]; }
if (data.constructor != Array) { data=[data]; }
- if (typeof(dt[0])!='function') {
+ if (typeof(dt[0])=='function') {
+ dt[0].apply(this,data);
+ } else {
for ( var i=0; i<dt.length; i++ ) {
- var div = document.getElementById(dt[i]);
- if (div.type =='text' || div.type=='textarea' || div.type=='hidden' ) {
- div.value=data[i];
- } else{
- div.innerHTML = data[i];
+ if (typeof(dt[i])=='function') {
+ dt[i].apply(this,[data[i]]);
+ } else {
+ var div = document.getElementById(dt[i]);
+ if (div.type =='text' || div.type=='textarea' || div.type=='hidden' ) {
+ div.value=data[i];
+ } else{
+ div.innerHTML = data[i];
+ }
}
}
- } else if (typeof(dt[0])=='function') {
- dt[0].apply(this,data);
}
this.pjxCompleted(dt);
},