I use Ajax constructs sporadically on my project, so I consider myself a novice. My situation is this: I am using Ajax within a web application to call a servlet for data/response. When my Ajax callback function is invoked, the first thing I want to do is to disable a button on my web page (using html button attribute 'disable). In my example, I have a huge response coming back from the servlet (an html table with over 10000 rows). I put the code in to disable the button (in the callback function) before setting the innerHtml of my div tag with the responseText. Unfortunately, the button does not get disabled (nor is any other alteration of the page doable) until the callback function is done rendering the contents of the responseText.
Question: is there a way to somehow 'interrupt' the callback function to disable the button? I assume that what is happening is that the Ajax/httpRequest takes control and needs to complete before control is given back to the browser? Any ideas would be greatly appreciated.
The developerWorks Connections platform will be sunset on December 31, 2019. On January 1, 2020, this community and its apps will no longer be available. More details available on our FAQ.
SystemAdmin 110000D4XK1140 Posts
Re: Interrupt Ajax Response2011-12-01T02:46:39ZThis is the accepted answer. This is the accepted answer.A button may be disabled in the callback function. Refer example in catalog form validation in which a Submit button is disabled in the callback function.