1 jls.loader.provide('jls.util.Sxe'); 2 3 jls.util.Sxe = jls.lang.Class.create({ 4 initialize : function(url) { 5 this._url = url; 6 }, 7 sendRecv : function(value, callback) { 8 new Ajax.Request(this._url, { 9 method :'post', 10 contentType :'text/plain', 11 postBody :value, 12 asynchronous :true, 13 evalJS :false, 14 evalJSON :false, 15 onException : function(transport, e) { 16 callback(null, e); 17 }, 18 onFailure : function(transport) { 19 callback(null, 'Fail to get text from ' + url); 20 }, 21 onSuccess : function(transport) { 22 /*if (transport.responseXML && transport.responseXML.childNodes && 23 transport.responseXML.childNodes.length && transport.responseXML.childNodes.length > 0) 24 { 25 callback(transport.responseXML, null); 26 } else { 27 callback(null, 'Fail to parse XML from ' + url); 28 }*/ 29 callback(new XML(transport.responseText), null); 30 } 31 }); 32 } 33 }); 34