Wait for finish print
Hey there guys, I'm working with an AJAX request that returns some stuff to print in 2 boxes. All working great, so I decided to make something fluffy, when I click a result in the AJAX request, he filters the clicked result, so you only see that clicked row. When clicked again, the old results will return. All working great.
Now, my problem, I wanted a checkbox after every row in the search results and when the user clicks twice on a result to filter it and than goes back to the old results to check the checkboxes again that were checked before filtering that component.
I made the functions and it didn't work till I put some alerts in, when the return function got some time to finish printing (like with the user had to click on OK in the alert) it worked. When I deleted the alerts, it didn't work again...
I searched on the internet, found a function to wait for an image to load or smth similar and I found some guys that used a function to wait for a specific time (1 sec for example) and that's not what I want. If I use a specific waittime it can still fail if the PC is slow, or whatever, it's just not nice coding.
So, is there something I can do so it waits till my AJAX request has been printed?
Disable the buttons while waiting for the ajax response.
In general you avoid much headache by disabling user input whilst waiting for the result of the last similar user input ;)
And you can be nice about it to:
If the wait is short you can let a button have a "pressed down" look while disabled.
If the wait is longer it could have a rotating symbol or something similar.
I'm not really sure if you understand me right, I have no buttons :o
Originally Posted by ironboy
Thanks again! :D
Anyone got an idea? Still got the problem... :(
Searched some around on the internet and really can't find a thing, it's okay if these posts get deleted for spam. I just want to know if someone knows something for this.
Is there no one else with this problem?
There is no way to detect that actual printing has finished.
Originally Posted by Pattatj
Try using the 1-second delay technique you mention - but in fact only a few milliseconds delay may be enough. There are several instances in both IE and FF where a short delay must be introduced - enough to allow the browser to "catch up". That is what your alerts are doing. It is nothing to do with whether the PC is slow or not.
Thanks a lot for your response, I will use a delay, thanks!
Originally Posted by Philip M