You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.6 KiB
JavaScript

/**
* (c) 2010 jxf - rpc module.
*
* The idea of behind this module is fetching data via an RPC-like call:
* . RESTful web services
* . XML/SOAP (not yet implemented)
* . Remote document (HTML; XML; JSON)
* . Local documents (HTML; XML; JSON)
* The module will return the data to a callback function should a parser be specified, the module will parse the data and return the parsed data to the callback function
* This allows the client code to minimize parsing should returned data be in a standard format.
* TODO:
* Improve on how returned data is handled (if necessary).
*/
if(!jx){
var jx = {}
}
// In order to insure backward compatibility
// Previous versions allowed the user to set the variable on the wrapper (poor design)
if(this.async != null){
this.setAsync(this.async) ;
}
http.open(method,url,this.obj.async) ;
for(key in this.obj.headers){
value = this.obj.headers[key] ;
http.setRequestHeader(key,value)
}
http.send(this.obj.data)
}
}
}//-- end of the factory method
return new factory() ;
}