[Proto-Scripty] Re: Ajax Request Timeout
@Matt Foster: your patch didn't work for me ?? in ff i didn't get the onTimeout event or if you get then it happend when the server is back online an the as often as it should happend while the offline time. i don't know why? i use an PeriodicalExecuter for my ajax request ... that's how i do it without timeout: --my apps code--- new PeriodicalExecuter( function (pe) { var successListener = function(transport, json){ appendPost('posts', transport.responseJSON); scrollToEnd(); //FireBUG### console.log(Event : ,AJAX : Request successed); //FireBUG### }; var failureListener = function(transport, json){ show_alert('Fehler beim Aufbau der Verbindung zum Server.'); //FireBUG### console.log(Event : ,AJAX : Request failed); //FireBUG### }; var exceptionListener = function(transport, json){ show_alert('Es liegt eine unbekannter Fehler vor.'); //FireBUG### console.error(Event : ,AJAX : Request exception happend); //FireBUG### }; new Ajax.Request('app.php', { method:'post', parameters: { controller: 'check' }, onSuccess: successListener, onException: exceptionListener, onFailure: failureListener }); }, 4); --- i've used your patch an added an onTimeout event an the other stuff, but under Firefox this event just happend when the server is back online under InternetExplorer it worked fine???! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Ajax Request Timeout
hi But leaving aside status 0, just a logical point. The third condition in your updated code: return (status = 200 status 300 status != 0); ...is irrelevant and will never be evaluated. If 200 = x 300, x cannot be zero. i can't believe what piece rubbish of code i have written, my brain must have bin offline :'( i think the zero comes from that part: --- line: 1499-- getStatus: function() { try { return this.transport.status || 0; } catch (e) { return 0 } } --- so Firefox must leave the status undefined. @ Matt Foster : i tried your patch but it didn't work for me, but maybe its my fault ... maybe it was a bad day of coding for me :) i will try it again yes the Ajax part off prototype is a bit uncomfortable by the way sorry I am not a native English speaker, so don't be mad with me ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Ajax Request Timeout
Hey Rick, My proposed idea in that article requires you to actually redefine the Ajax.Request. If we can solidify the idea we could submit the code as a patch to core but as of now you've gotta either replace it in the source library itself or just redefine it after the library but before any implementation. Review that demo page to see how I had done it and you could probably get it working. On Jul 14, 1:57 pm, Rick dun...@googlemail.com wrote: hi But leaving aside status 0, just a logical point. The third condition in your updated code: return (status = 200 status 300 status != 0); ...is irrelevant and will never be evaluated. If 200 = x 300, x cannot be zero. i can't believe what piece rubbish of code i have written, my brain must have bin offline :'( i think the zero comes from that part: --- line: 1499-- getStatus: function() { try { return this.transport.status || 0; } catch (e) { return 0 } } --- so Firefox must leave the status undefined. @ Matt Foster : i tried your patch but it didn't work for me, but maybe its my fault ... maybe it was a bad day of coding for me :) i will try it again yes the Ajax part off prototype is a bit uncomfortable by the way sorry I am not a native English speaker, so don't be mad with me ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Ajax Request Timeout
Yeah I discuss the idea of having its own event for timing out in my article. The argument is a timeout is a failure, its failed to retrieve a response in the given time. So a timeout is basically like an inherited event from onFailure. Question remains do you seperate the event or just add a flag to the XHR to indicate the reason for failure is its timed out. Obviously you side with the latter as did Tobie so perhaps it would be best to dispatch both events for ease of implementation. Also that success method looks exactly like what TJ suggested and I posted, so good going on that. On Jul 14, 3:56 pm, Rick dun...@googlemail.com wrote: currently i just fixed the success function success: function() { var status = this.getStatus(); return (status = 200 status 300); }, and just watch the onFailure and onException event. But i would like to have an onTimeout event, so if we get an solution for a crossbrowser working onTimeout event, we can submit it. I have read about an solution but this one was rejected because it didn't worked in safari, etc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---