Aaron, thanks for the reply, but the problem is that onSuccess never fires - I have done some more investigation and it looks like there is a bug in WebKit with Async requests and Form Posts
https://bugs.webkit.org/show_bug.cgi?id=23933 The workaround appears to be to set async: false on the request. Regards, Richard. On Oct 26, 5:37 pm, Aaron Newton <[email protected]> wrote: > have you tried throwing a try/catch around the onsuccess contents and > logging any errors you encounter? > > On Mon, Oct 26, 2009 at 3:41 AM, FrozenSkys <[email protected]>wrote: > > > > > > > I can get the code below to work on all other browsers but in both > > chrome and safari (both WebKit based) I get the onrequest() event > > firing but nothing else - This happens both on windows and OS X. I > > have tried debugging with the console and using Fiddler2 but with no > > joy - from fiddler it looks like the request is never actually made. > > There is a basic example athttp://app2.frozenskys.comthat this code > > is taken from. > > > Thanks in Advance > > Richard. > > > <script type="text/javascript" charset="utf-8"> > > var uuid = "" > > > for (i = 0; i < 32; i++) { > > uuid += Math.floor(Math.random() * 16).toString(16); > > } > > > var req = new Request({ > > method: 'get', > > headers: {'X-Progress-ID': uuid}, > > url: 'http://app2.frozenskys.com/upload/progress/', > > initialDelay: 500, > > delay: 1000, > > limit: 10000, > > onSuccess: function(reply) { > > console.debug("Got a reply"); > > test = JSON.decode(reply); > > console.dir(test); > > console.debug(test.state); > > switch(test.state) { > > case "uploading": > > percent = 0.00 + parseFloat(Math.floor > > ((test.received / test.size)*1000)/10); > > console.debug("Uploading : %s", percent); > > break; > > case "starting": > > console.debug("Starting..."); > > break; > > case "error": > > console.debug("Error : %s", test.status); > > console.warning("Error : %s", test.status ); > > break; > > case "done": > > console.debug("Done..."); > > req.stopTimer(); > > break; > > default: > > console.debug("Oooops!"); > > break; > > } > > }, > > onRequest: function(){ > > console.debug("Request Started"); > > }, > > onComplete: function(){ > > console.debug("Request Complete"); > > }, > > onException: function(header,value){ > > console.debug("Exception setting : %s", header); > > console.dir(header); > > console.dir(value); > > }, > > onFailure: function(xhr){ > > console.debug("Failure : %s", xhr); > > console.dir(xhr); > > } > > }) > > > $('submit').addEvent( 'click', function(evt){ > > console.debug("StartProgressBarRequests"); > > filename = $("id_file").get('value').split(/[\/\\]/).pop(); > > document.getElementById("upload_form").action="/upload/?X- > > Progress-ID=" + uuid > > req.startTimer('X-Progress-ID=' + uuid); > > }); > > > </script>
