tag:blogger.com,1999:blog-21222625.post3744996709856706621..comments2023-10-26T08:02:30.987-04:00Comments on The Pothoven Post: Aborting Ajax requests (for prototype.js)Unknownnoreply@blogger.comBlogger14125tag:blogger.com,1999:blog-21222625.post-42684586235020697022010-07-30T13:11:49.559-04:002010-07-30T13:11:49.559-04:00Excellent article! I don't understand what are...Excellent article! I don't understand what are waiting Prototype to include this change on their code.<br /><br />About the abort problem in some situations where the Ajax.activeRequestCount becomes negative and to avoid future problems when updating prototype as it was commented before, I did the following:<br /><br />a) create a prototype_extended.js file and include it after including prototype.js to take effect.<br /><br />b) put the following code:<br />Ajax.Responders.register({<br />onComplete: function(){ <br />//alert ('inside oncomplete code section...');<br /> Ajax.activeRequestCount--;<br /> <br />if (Ajax.activeRequestCount < 0) {<br />Ajax.activeRequestCount = 0;<br />}<br />}<br />});Daniel Gandrahttp://mugergan.selfip.comnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-67779575359267617862009-12-14T13:28:03.768-05:002009-12-14T13:28:03.768-05:00Hey are you a professional journalist? This articl...Hey are you a professional journalist? This article is very well written, as compared to most other blogs i saw today…. <br />anyhow thanks for the good read!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-29762355032679612032009-04-27T15:22:00.000-04:002009-04-27T15:22:00.000-04:00Thanks for posting this. I have been looking for s...Thanks for posting this. I have been looking for something like this for a long time. I too was surprised not to find built in support as a part of Prototype's AJAX library.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-78686435076304411232009-04-08T08:16:00.000-04:002009-04-08T08:16:00.000-04:00I'm using firefox and tried your solution on my pr...I'm using firefox and tried your solution on my project. When I abort ajax request code seems to work fine and nothing is done after aborting, but my firebug still shows there's a request running and it won't never stop. Is this only firebug's problem? I don't know but I decided to ask you if you have any knowledge about this.Juissinoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-51723487323960746522008-03-10T06:29:00.000-04:002008-03-10T06:29:00.000-04:00Its very likely that this hasn't been included in ...Its very likely that this hasn't been included in prototype because the abort method in XHR isn't supported by IE<7. Great addition though and when combined with a little object detection there's no reason it cant be implemented as a progressive enhancementUnknownhttps://www.blogger.com/profile/00393917494185348047noreply@blogger.comtag:blogger.com,1999:blog-21222625.post-13804151633257472052008-02-19T23:00:00.000-05:002008-02-19T23:00:00.000-05:00Thanks you verymuch. This is very usefull for me.Thanks you verymuch. This is very usefull for me.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-10760435700175237312008-01-28T11:30:00.000-05:002008-01-28T11:30:00.000-05:00I use essentially the same code and have not encou...I use essentially the same code and have not encountered any issues with negative values.<BR/><BR/>Are you aborting a request that has already completed? In my response handling functions, I always set my saved Ajax object to null, and check the object before calling abort in it.Steven Pothovenhttps://www.blogger.com/profile/12363162933609862672noreply@blogger.comtag:blogger.com,1999:blog-21222625.post-90369197250753922102008-01-26T13:57:00.000-05:002008-01-26T13:57:00.000-05:00Hi,First of all thanks.I seem to get negative Ajax...Hi,<BR/><BR/>First of all thanks.<BR/><BR/>I seem to get negative Ajax.activeRequestCount when using the code in conjunction with Ajax.Responders. I commented out the line "Ajax.activeRequestCount--;" and now it seems fine. Here is my code if that matters at all:<BR/><BR/>Ajax.Responders.register({<BR/> onCreate: function() {<BR/> //alert("# of request is "+Ajax.activeRequestCount);<BR/> if($('indicator1') && Ajax.activeRequestCount>0)<BR/> $('indicator1').show();<BR/> },<BR/> onComplete: function() {<BR/> if($('indicator1') && Ajax.activeRequestCount==0)<BR/> $('indicator1').hide();<BR/> },<BR/> onUninitialized: function() {<BR/> if($('indicator1') && Ajax.activeRequestCount==0)<BR/> $('indicator1').hide();<BR/> }<BR/>});Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-6209658835964581922008-01-26T13:54:00.000-05:002008-01-26T13:54:00.000-05:00Hi,Thanks for the code first of all.I seem to have...Hi,<BR/><BR/>Thanks for the code first of all.<BR/><BR/>I seem to have some issue with Ajax.activeRequestCount when using it in conjunction with Ajax.Responders. The activeRequestCount became negative. I commented out the "activeRequestCount--" line and it now seems fine.<BR/><BR/>Here is my code for the responders:<BR/><BR/>Ajax.Responders.register({<BR/> onCreate: function() {<BR/> //alert("# of request is "+Ajax.activeRequestCount);<BR/> if($('indicator1') && Ajax.activeRequestCount>0)<BR/> $('indicator1').show();<BR/> },<BR/> onComplete: function() {<BR/> if($('indicator1') && Ajax.activeRequestCount==0)<BR/> $('indicator1').hide();<BR/> },<BR/> onUninitialized: function() {<BR/> if($('indicator1') && Ajax.activeRequestCount==0)<BR/> $('indicator1').hide();<BR/> }<BR/>});Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-2716820073877943302008-01-25T08:27:00.000-05:002008-01-25T08:27:00.000-05:00I would recommend that you just add it to your own...I would recommend that you just add it to your own JavaScript code sometime after you've included the prototype.js code.<BR/><BR/>I would not recommend you adding to the prototype.js file (or any other 3rd party library) as it then complicates the process of upgrading to new versions since you need to remember to copy over all the additions you have made.Steven Pothovenhttps://www.blogger.com/profile/12363162933609862672noreply@blogger.comtag:blogger.com,1999:blog-21222625.post-25655431857682758752008-01-25T03:57:00.000-05:002008-01-25T03:57:00.000-05:00Thanks so much Steve. Please excuse my newbieness....Thanks so much Steve. Please excuse my newbieness. How do i integrate your abort code with my javascript module? Do I paste it in prototype.js or in my own module?<BR/><BR/>Thanks so muchAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-68258074518590911622008-01-18T16:33:00.000-05:002008-01-18T16:33:00.000-05:00Great article and thanks to Steven for helping me ...Great article and thanks to Steven for helping me implement it!<BR/><BR/>This should really be included in the official prototype.js.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-13580451172241454172008-01-12T20:41:00.000-05:002008-01-12T20:41:00.000-05:00Cheers mate. This sseems to have resolved an issue...Cheers mate. <BR/><BR/>This sseems to have resolved an issue I was having when only calling: this.transport.abort();<BR/><BR/>Maybe you can shed some light on why the absence of the first line was preventing a concurrent Element.update() from executing?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21222625.post-39920523098836379012008-01-12T20:40:00.000-05:002008-01-12T20:40:00.000-05:00Cheers mate. This sseems to have resolved an issue...Cheers mate. <BR/><BR/>This sseems to have resolved an issue I was having when only calling: this.transport.abort();<BR/><BR/>Maybe you can shed some light on why the absence of the first line was preventing a concurrent Element.update() from executing?Anonymousnoreply@blogger.com