| | |
Terminating AJAX threads
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I don't think there is a way to terminate the call - apart from closing the document. Prototypes are similar to objects - if you are familiar with OOP? If you have a prototype 'instance' then you can avoid deadlock situations, consider what is deadlocking and establish if it needs to be a shared resource.
If this fails, then lock down your page until the initial query has executed - I notice several sites doing this, they paint the page a darker shade... I think its a pretty crapy solution, but I guess sometimes it must be difficult to avoid.
If this fails, then lock down your page until the initial query has executed - I notice several sites doing this, they paint the page a darker shade... I think its a pretty crapy solution, but I guess sometimes it must be difficult to avoid.
•
•
•
•
Hi All,
Is there a way to terminate an AJAX thread. I have an application where if a user selects multiple options in a rapid succession it causes a deadlock situation.
I would like to terminate the previous thread, if a new one is spawned. I am using prototype.
Thanks,
Shivaraj
If you use the same XMLHTTPRequest instance, calling open() a second time will terminate the first request.
I'm sure the Prototype JavaScript Library has a corresponding method for abort().
A more efficient design would be to only call an XMLHTTPRequest if the option selected stays for over a few milliseconds.
eg:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
var req_timer; function makeRequest() { clearTimeout(req_timer); var req_timer = setTimeout(function() { XHR(); }, 100); }
Then you can implement abort() also.
clearing the timeout is much more efficient that aborting the HTTP Request. Especially if you don't make sure an abort from the HTTP Client will actually terminate the Script running on the server. Some scripts will keep executing and the server sends the HTTP Response even though the browser discards it.
Last edited by digital-ether; Aug 14th, 2007 at 7:52 am.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
- I want google to index forum threads (Search Engine Optimization)
- javascript / ajax tutorials (JavaScript / DHTML / AJAX)
- new way the threads are timed (DaniWeb Community Feedback)
- IE won't let me access threads. Could someone email me a solution please? (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: random slideshow with random timer...
- Next Thread: Problem in JS when i upgraded my Jar Files for MyFaces
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array browser bug captchaformproblem cart checkbox child class close codes createrange() css cursor date debugger decimal dependent design disablefirebug dom dropdown editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming progressbar prototype redirect runtime safari scale scriptlets scroll search security shopping size software toggle unicode w3c web wysiwyg \n






