Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 5th, 2008, 05:24 AM
Familiar Sight
 
Join Date: Aug 2007
Posts: 148
Default Abort the AJAX Request

Hi All,

I am using dojo.xhrPost to send an ajax request.I would like to know if there is a way that when another javascipt event is executed before that request was finished, can I abort that request.
How can i abort the request? Thanks in Advance...
Reply
  #2  
Old September 5th, 2008, 08:04 AM
Dormilich's Avatar
Expert
 
Join Date: Aug 2008
Location: Leipzig, Germany
Age: 31
Posts: 638
Default

why do you want to abort the ajax request?

nevertheless, you only need a second condition (besides request.status == 200) that the second javascript invokes.
Reply
  #3  
Old September 5th, 2008, 08:29 AM
Ferris's Avatar
Member
 
Join Date: Oct 2007
Location: Shanghai
Age: 22
Posts: 102
Default

I don't think you can abort ajax request. You can ignore handle the ajax response. for example:

Expand|Select|Wrap|Line Numbers
  1. var ajaxHandler = function( returnData )
  2. {
  3.     if ( flag == false )
  4.     {
  5.         //do something with the returnData
  6.     }
  7. }
  8.  
  9.  
  10. var otherEventHandler = function()
  11. {
  12.     flag = true;    //When another event is executed,set flag to true.
  13. }
  14.  
  15.  
  16. var flag = false;    //false when handle ajax response
  17. var ajax = new Ajax(...);    //initialize ajax object
  18. ajax.onreadystatechange = ajaxHandler;    //set ajax handler
  19. ajax.post(...);
  20.  
  21.  

hope it helps
Reply
  #4  
Old September 5th, 2008, 09:33 AM
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Age: 36
Posts: 3,388
Default

in case you have a reference to the requestobject then you may use its abort()-method ... have a look at it here

kind regards
Reply
  #5  
Old November 18th, 2008, 09:16 AM
Familiar Sight
 
Join Date: Aug 2007
Posts: 148
Default ajaxRequest.abort()

Hi,
I'm using dojo 1.1 in my application. How do i abort the ajax call in that?
please do needfull.
Reply
  #6  
Old November 18th, 2008, 09:49 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,727
Default

Merged threads. Please do not double post your questions (even after a few months). Thanks.
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles