Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4040124
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:42:41+00:00 2026-05-20T12:42:41+00:00

$( document ).bind( ‘mousemove’, function ( e ) { if ( e.pageY > $(

  • 0
$( document ).bind( 'mousemove', function ( e )
{
    if ( e.pageY > $( document ).height() - 400 )
    {
        $.ajax( {
            url: '/Tweet/GetFiveUserTweets',
            type: 'POST',
            async: false,  // preventing a lot of asynchronous requests            
            success: function ( result )
            {
                // result
            }
        } );
    }
} );

‘async:false’ hangs the browser until request completes and that’s not good.

and when remove ‘async:false', dozen of simultaneous request made because mousemove event….

I don’t want to hang the browser.

I just want a single asynchronous Ajax request at a time.

Can anyone let me know how to do a better coding for this situation?

Edit:

Actually when user scroll down at bottom, I want to get five next records and append them at bottom. http://www.twitter.com do this with tweets….

what’s about:

$(window).bind('scroll', function () {
 if (nearBottomOfPage()) {
   // load things here ...
 }
});

I think it’s better than mousemove…am I right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:42:42+00:00Added an answer on May 20, 2026 at 12:42 pm

    make async true.

    To avoid multiple simultaneous requests, before starting a request, check a variable, for example if(!active_check) {...} and then set that variable when you start, active_check=true. When the request completes, set the variable to false/null again.

    if(!active_check) {
      active_check=true;
      //do request with callback to change active check when done
    }
    

    or using your code…

    $( document ).bind( 'mousemove', function ( e )
    {
        if ( (e.pageY > $( document ).height() - 400) && !active_check)
        {
            active_check = true;
            $.ajax( {
                url: '/Tweet/GetFiveUserTweets',
                type: 'POST',
                async: true,  
                success: function ( result )
                {
                    active_check = false;
                }
            } );
        }
    } );
    

    That said, the mousemove event fires extremely frequently. You’ll want to use something else, if you can.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following snippet: $(document).bind('mousemove', function(e) { $('#someDiv').css({left: e.pageX+'px', top: e.pageY+'px'}); }); This should
I have 2 keydown handlers: $(document).bind('keydown', function(e) { if (e.keyCode == 75) { //
you can disable the menu $(document).bind(contextmenu, function(e) { return false; }); you can show
I use jQuery-hotkeys And the following code: $(document).bind('keydown', 'ctrl+s', function(){$('#save').click()}); but I cannot disable
$(document).ready( function() { $('input[id^=btnRemoveCategory]').bind( 'click', function(){ if($('input[id^=chkIsBottom_:checked]')) alert('YES YES YES!!!!'); else alert('No NO no!!!!!');
$(document).ready(function() { $(span.link).mouseover(function(e){ $(this.children).css(display,inline); }); }); I'm not a javascript expert, but I've cobbled
$(document).ready(function(){ $(.txtDate).datepicker({ showOn: both, buttonImage: library/ui/datepicker/img/calendar2.gif, dateFormat: yy/mm/dd, buttonImageOnly: true }); //added this checkbox
I'm using the document.form.submit() function for a rather large input form (hundreds of fields,
I have the following code. <html> <head> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js></script> </head> <div id=hello>Hello <div>Child-Of-Hello</div></div>
I'm implementing a document server. Currently, if two users open the same document, then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.