Steve Ramage schrieb: > > We’ve developed an Ajax application with our (read mine) own built > from scratch JS Interface. Needless to say it’s crap and I’m > investigating rewriting the UI portion from scratch with Qooxdoo. Both > the Application and API are already well defined and work fine, and it > would be preferred if we didn’t have to rewrite the client/server > interaction. The current API uses either GET or POST requests and > returns XML data. Our current application runs on a separate web > server from where the Qooxdoo interface is being run. >
Cross domain AJAX requests is a special topic. It is only possible with the use of dynamically inserted script tags and the data transferred MUST be JavaScript code. This code is executed in the context of the qooxdoo application. This transferred JS should call the statics method <http://demo.qooxdoo.org/0.7-beta1/apiviewer/#qx.io.remote.ScriptTransport#_requestFinished> , which will fire the complete event. Best Fabian > I am currently only trying to get the response from the server but > can’t seem to get it. > > The code is: > > button1.addEventListener("execute", > > function(e) { > > w1.setStatus('Sending Credentials...'); > > button1.setEnabled(false); > > text1.setEnabled(false); > > text2.setEnabled(false); > > var url = 'http://server/api.php'; > > var ajaxRequest = new qx.io.remote.Request(url,'GET',"text/plain"); > > with (ajaxRequest) > > { > > setAsynchronous(true); > > setRequestHeader("Content-Type","application/x-www-form-urlencoded"); > > setParameter('test','test'); > > setCrossDomain(true); > > addEventListener("completed",function(e) { > > e.getData().getContent(); } ); > > addEventListener("timeout",function(e) { > > alert("App API (" + url + ") did not respond"); > > w1.setStatus('Could not contact server.'); > > button1.setEnabled(true); > > text1.setEnabled(true); > > text2.setEnabled(true); > > } ); > > send(); > > } > > }, > > w1); > > The result is a timeout. > > The qx_log displays: > > 010811 INFO: qx.component.init.InterfaceInitComponent[30]: finalize runtime: > 63ms > 011233 DEBUG: qx.component.init.InterfaceInitComponent[30]: preloading hidden > images... > 011264 DEBUG: qx.component.init.InterfaceInitComponent[30]: preloading > complete > 019857 WARN: qx.io.remote.RequestQueue[409]: Timeout: transport 412 > 019857 WARN: qx.io.remote.RequestQueue[409]: 5484ms > 5000ms > 019872 WARN: qx.io.remote.Exchange[412]: Timeout: implementation 421 > > The weird thing is that a Javascript Error is generated in both > Firefox and IE. In IE it says there is a syntax error on line 1. > Firefox is more descriptive with: > > Error: missing ; before statement > > Source File: > http://server/api.php?_ScriptTransport_id=2&nocache=1179709434718&test=test > > Line: 3, Column: 50 > > Source Code: > > <apierror>AUTH REQUIRED</apierror><apimessage>You are required to > login</apimessage></response> > > The Source Code is the response from the server which is the result I > was expecting back. The server is not actually timing out but is > responding. I haven’t been able to find an sample code on Ajax > requests for 0.6.6 so I just pieced the above from various mailing > list postings. I did download the full SDK. Any ideas? > > Steve Ramage > Software Developer > Email: [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > -- Fabian Jakobs JavaScript Framework Developer 1&1 Internet AG Brauerstraße 48 76135 Karlsruhe Amtsgericht Montabaur HRB 6484 Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Andreas Gauger, Matthias Greve, Robert Hoffmann, Norbert Lang, Achim Weiss Aufsichtsratsvorsitzender: Michael Scheeren ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
