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

  • SEARCH
  • Home
  • 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 4584494
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:21:46+00:00 2026-05-21T21:21:46+00:00

I am using cody sherman’s javascript code here: http://codysherman.com/tools/infinite-scrolling/code I am also using a

  • 0

I am using cody sherman’s javascript code here: http://codysherman.com/tools/infinite-scrolling/code

I am also using a simple jquery script to dynamically change the background-images of the divs that hold the tumblr posts.

The jquery code works fine but I need a way to call the function again when the infinite scrolling script updates with new posts. A way of them talking to each other I guess.

You can see the page here: http://hypergeography.tumblr.com/
(It isn’t using the infinite scrolling yet. but it does have the script that changes the background images.)

Any help would be appreciated.

  • 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-21T21:21:47+00:00Added an answer on May 21, 2026 at 9:21 pm

    If you feel safe enough, you could definitely get into that code (it’s not long at all) and add some logic to the onreadystatechange section. This event is fired once the Ajax call is complete. If you hook into it, you could easily add something to talk to your code.

    Another way is to hijack XMLHttpRequest, so that once its send() method is called, you attach your own event listener that monitors that request for the ‘load’ event. Once the request is done, you can call your custom functions. This could be done like this:

    XMLHttpRequest.prototype.originalSend=XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send=function(s){
        this.addEventListener('load',function(){
            //CALL YOUR CODE HERE
        },false);
        this.originalSend(s);
    }
    

    Or instead, you could hijack the onreadystatechange function to add some of your own logic:

    XMLHttpRequest.prototype.originalSend=XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send=function(s){
        if(this.onreadystatechange){
            var oldORSC=this.onreadystatechange;    
        }
        this.onreadystatechange=function(){
            if (this.readyState==4 && this.status==200){ //a successful request
                    //CALL YOUR CODE HERE
            }
            if(oldORSC){
                oldORSC();
            }
        }
        this.originalSend(s);
    }
    

    Of course, if you wanted to support IE, you would have to do similar things withe the ActiveXObject that they use for AJAX. But I don’t use it so I can’t give you any examples.

    EDIT: this assumes your page is making calls only for this purpose. If you have other AJAX calls, you will need to add logic to determine which call is being used. For this, you could hook into the open() method and inspect the URL or parameters or whatever specific information will help you determine where the call is going, and then modify the request accordingly.

    ALSO: make sure that these hijacks are called FIRST, before any of the other javascript.

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

Sidebar

Related Questions

Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Context: HTML widgets generated using a Django ModelForm and template, jQuery 1.3.2, JavaScript on
Using online interfaces to a version control system is a nice way to have
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Using JDeveloper , I started developing a set of web pages for a project

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.