var rpc = new leimnud.module.rpc.xmlhttp(
{
url :'ex.rpc.php',
method :"POST"
args :'argument='+{var1:1,var2:2,var3:[1,2,3]}.toJSONString()+"&other=OtherData"
});
rpc.callback=function(rpc)
{
alert(rpc.xmlhttp.responseText)
};
rpc.make();
Sample:
AƱadir contenido a un panel por medio de Ajax.
Example:
var r = new leimnud.module.rpc.xmlhttp({url:"ex.core.php"});
r.callback=leimnud.closure({Function:function(rpc){
myPanel.addContent(rpc.xmlhttp.responseText);
},args:r})
r.make();
Ejecutar javascript
var r = new leimnud.module.rpc.xmlhttp({url:"ex.core.php"});
r.callback=leimnud.closure({Function:function(rpc){
var scs=rpc.xmlhttp.responseText.extractScript(); //capturamos los scripts
myPanel.addContent(rpc.xmlhttp.responseText.stripScript());//Eliminamos porque ya no los necesitamos
scs.evalScript(); //interpretamos los scripts
},args:r})
r.make();