Hi Matthew,

Sorry I'm reply so late. I thought the same thing as well. It does
cancel the request. And the link which I'm passing is to a local RSS
Feed Parser (which takes more than 3-4 seconds to parse everything).
And it's just one request. I had tried link:cancel but it didn't help
much. I think there's something up with the browser daemon (or w/e)
which carries out the rss feed fetching even though my request has
cancelled).
I've decided to remove this functionality and stick to using a Cron
job to update my feeds.

Thanks for your help though!

On Mar 17, 10:13 am, "Matthew Hazlett" <[email protected]> wrote:
> I pasted your code in a mooshell and called the cancel method and its ok.  
> As far as I know when you cancel the request it stops.  
>
> You could try adding: "link: 'cancel'" to your options.
> (but this would only matter if you made two concurrent requests)
>
> But as far as I can see the cancel method works fine (firebug's output):
> POSThttp://mootools.net/shell/ajax_html_echo/   Aborted
>
> http://mootools.net/shell/6spkD/
>
> This is speculation:
> The only other thing I can think of making your load times take 5 seconds is
> if the destination page has not completing loading and the synchronies call
> to request is waiting for the page to complete before it can actually quit.
> However, this does not make sense as the default for request method is
> asynchronies.
>
>
>
> -----Original Message-----
> From: [email protected]
>
> [mailto:[email protected]] On Behalf Of WarpY
> Sent: Wednesday, March 17, 2010 11:58 AM
> To: MooTools Users
> Subject: [Moo]HelpwithRequest.cancel().
>
> Hi,
> I'm fairly new to web development and JavaScript in general.
> I am trying to build this MooTools script where I fire a
> Request.send() and it goes out and fetches data from certain URLs.
> Doing this takes the function 5+ seconds to complete. So, when I
> unload the web page, I want to fire aRequest.cancel() method to stop
> fetching data from those URLs.
>
> var r = new Request( {
>         method : 'get',
>         url : someurl,
>         onRequest : function() {
>             window.addEvent('beforeunload', function() {
>                 r.cancel();
>             });
>         },
>         onCancel : function() {
>             alert('Ok, cancelling.');
>         },
>         onComplete : function(response) {
>             alert(response);
>         }
> }).send();
>
> Above is the code which I'm using.
> The problem: When I try reloading the page (while the request is still
> active) in order to fire the cancel method, it does the cancel and
> sends me the alert (look at code) as well. But, the script still takes
> the accounted 5+ seconds to operate and once it's done, my page
> reloads. I do not want this to happen and want the script to die
> completely so that I can reload instantly. Pleasehelp.
>
> PS: If anything needs clarification please say so. I'm new to these
> forums.
>
> Thank you!

To unsubscribe from this group, send email to 
mootools-users+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to