Basic Problem is Every scroll of scrollbar makes an ajax call.So if user play with scrollbar say 100 times 100 ajax calls go and server starts processing 100 calls.So abort won't help.The last time the scroll bar has stopped scrolling(say for 1000 millisecond),ajax call should go.My function uses object function call.So how can i use setTimeOut()
My function looks likes this
temp contain xmlHTpp object -
var temp=new xmlHttpObject();
-
-
div.onscroll={temp.makeAjaxCall()};
-
here temp.makeAjaxCall should not be called until scrolling is stopped alteast for 1000 millisecond
5 2315
I would like to know answer too. But I would make it that way:
[HTML]<script language="javascript">
var timeoutID = null;
function ajax_function()
{
timeoutID=null;
alert('i am in ajax function');
}
</script>
[/HTML]
and set onscrollevent this way:
[HTML]<div onscroll="if (timeoutID){clearTimeout(timeoutID)}; timeoutID=setTimeout(ajax_function,1000);">[/HTML]
But I am not sure how "hard" it is for browser to start/terminate timeouts (because browser will process onscrollevent many times). Test it and let me know .. If someone else know "cleaner" solution, I would like to hear it too.
:( i want object passed to setTimeOut
Here is something I've not tested, but worth a try:
Use the Date object. Whenever a scroll action takes place, update a variable with the time in milliseconds.
At the same time, a setInterval is continuously running a function every 500 milliseconds. It checks this variable to see if 1000 milliseconds have passed. If not, nothing happens. If they have passed, make the Ajax request.
Here is something I've not tested, but worth a try:
Use the Date object. Whenever a scroll action takes place, update a variable with the time in milliseconds.
At the same time, a setInterval is continuously running a function every 500 milliseconds. It checks this variable to see if 1000 milliseconds have passed. If not, nothing happens. If they have passed, make the Ajax request.
Thnx acoder
BUT
The problem is that the function that is to be called from setInterval is object funtion call :(. That is it go be like this
setInterval(object.function(),100);
but setInterval takes only string to be passed as function call
Any Help
No, that's not the case. See, for example, this link.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: idriss |
last post by:
i want to scroll one frame's or canvas 's whole content (it will contain
other subframes and subframes will contain bitmaps) I couldn't find
where is my fault. if you can find my fault or have some...
|
by: Brian |
last post by:
I've used the syncfusion method to autosize my datagrid row heights. The
problem I run into is the vertical scrollbar does not take into account the
new row heights. When I scroll to the bottom I...
|
by: Roy Harbert |
last post by:
How do I get the editor to scroll with the mouse wheel????
|
by: Code Monkey |
last post by:
using VS2005 and c# to create a windows forms application.
One of my forms has a panel which I've added various controls to. Now,
I've set the autoscroll property to true, which is great, but I...
|
by: Joel Byrd |
last post by:
I am making an AJAX call when any one of a number of inputs in a form
(search criteria) are clicked, checked, changed, etc. When the user
clicks, checks, whatever, I am trying to display a...
|
by: monudjn |
last post by:
Hi I am implementing ajax in portal. Using ajax i am able to updating the content of portlets asynchronously. However i am facing a problem
The Problem: While submitting the form i am getting...
|
by: violinandviola |
last post by:
I have just put 4 different ajax bits on this page:
http://jimpix.co.uk/default-ajax.asp
The ajax spits out chunks of images / news content, and users can view
the chunks via next / prev links....
|
by: sheldonlg |
last post by:
I haven't received an answer with my other post, so I am rephrasing it here.
In php I have a 2D array which I "print". The headers force it to be a
file on the user's system. The user receives...
|
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: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
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: 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
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |