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...
10 6072
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.
I don't think you can abort ajax request. You can ignore handle the ajax response. for example: -
var ajaxHandler = function( returnData )
-
{
-
if ( flag == false )
-
{
-
//do something with the returnData
-
}
-
}
-
-
-
var otherEventHandler = function()
-
{
-
flag = true; //When another event is executed,set flag to true.
-
}
-
-
-
var flag = false; //false when handle ajax response
-
var ajax = new Ajax(...); //initialize ajax object
-
ajax.onreadystatechange = ajaxHandler; //set ajax handler
-
ajax.post(...);
-
-
hope it helps
gits 5,390
Expert Mod 4TB
in case you have a reference to the requestobject then you may use its abort()-method ... have a look at it here
kind regards
Hi,
I'm using dojo 1.1 in my application. How do i abort the ajax call in that?
please do needfull.
ISSUE IN ABORTING XHRPOST
We are using Dojo 1.1 to display data in grid format.
When the display button is clicked grid will be displayed and ajax calls( dojo xhrpost) will be initiated to fetch data. AJAX calls will update the session with fetched data. AJAX calls will be initiated until all the data is fetched.( Complete data set cannot be fetched at a stretch, as the data set is large. Hence we use AJAX calls to update the session)
If the display button is clicked again, the ongoing AJAX cals should be aborted and new AJAX calls should be triggered for the new serach criteria.
We are unable to abort the ongoing AJAX calls. The previous AJAX calls and the new AJAX calls are updating the data in session leading to incorrect data.
Please provide us some suggestion
Thanks
Check post #4 by gits. If that doesn't help, check the API reference on the dojo website.
How can we get the reference of XMLHTTPRequest in DOJO
This link might help. Use the cancel() method. If that doesn't work, you can use the abort() method on the args object passed to the xhrPost function.
gits 5,390
Expert Mod 4TB here is another link that might be of help.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: petermichaux |
last post by:
Hi,
Is it possible for an AJAX request to be left open for multiple
responses? This could avoid repetitive polling of the server.
Thanks,
Peter
|
by: dougwig |
last post by:
I'm trying to handle the scenario where a user's session times out and
and their ajax request triggers a redirection by the webserver (302
error?).
I'm using Prototype 1.4 and the my works great...
|
by: arunprabu |
last post by:
Hi,
I have a problecm with the AJAX request in my webpage. I have some
filters on top of the page. I have a submit button and an empty div
below the filters.
Some of the filters have ajax...
|
by: Simon |
last post by:
I have the following code in Javascript which is creating and sending
an XMLHttpRequest .
<code>
var xmlHttp;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlHttp = new...
|
by: nikki.farrah |
last post by:
Hi all, this is my first time posting so any help is appreciated! I
am doing a simple AJAX request to our server, and I would like the
cursor style changed to 'wait' when the user clicks a button...
|
by: Sebarry |
last post by:
Hi,
I have a Javascript function that creates an Ajax Request object in order to retrieve data from a database using a PHP script. The Javascript function is invoked by another Javascript function...
|
by: mentor |
last post by:
When user is authenticated, the server store "UserName" in session. Then throug ajax, the user request another page which require authentication. How the ajax request tell the server that one has...
|
by: Frinavale |
last post by:
I have a JavaScript class that displays a partially-opaque div over top of the content of another div when an Ajax request is sent to the server.
When the request returns, the JavaScript class...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |