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 5934701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:09:01+00:00 2026-05-22T15:09:01+00:00

In github’s blog post about how they created the new tree slider, they give

  • 0

In github’s blog post about how they created the new tree slider, they give this as the code used:

$('#slider a').click(function() {
  history.pushState({ path: this.path }, '', this.href)
  $.get(this.href, function(data) {
    $('#slider').slideTo(data)      
  })
  return false  
})

However I don’t see how this works? They AJAX request the whole new page, so from <html> to </html> inclusive, then seemingly (using a method called ‘slideTo’??) put this data into the slider element? Surely then you’d end up with a page within a page (likely with CSS glitches).

How when using AJAX and History API, do you get only the specific section that has changed? Or is it that the html code is replaced (but this is not the case in the above example)?

Where is the actual javascript github uses? And am I right that the example given can’t be what is used as it won’t work properly?

  • 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-22T15:09:02+00:00Added an answer on May 22, 2026 at 3:09 pm

    The server side code could check the X-Requested-With header, and make sure it is XMLHttpRequest (jQuery sets this header by default) and send only the inner view if requested with XHR.

    Firebug Example

    FireBug Example

    As you can see, the returned HTML is very different to what it would be had the request not been with XHR.

    Example PHP Code

    With a helping of self explanatory functions.

    $xhr = (isset($_SERVER['X-Requested-With')
        AND $_SERVER['X-Requested-With'] === 'XMLHttpRequest');
    
    $view = View::factory('inner/something');
    
    if ( ! $xhr) {
        $view = View::factory('template')
            ->set('innerView', $view);
    }
    
    echo $view;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://github.com/uswaretech/Django-Socialauth/tree/master/socialauth/ I'm a bit confused on how I should use this. Of course, I
I accidentally pushed a commit to GitHub. Is it possible to remove this commit?
http://github.com/samliu/rlinkset ^^ My code so far is pushed to there. Essentially, I'm using resource_controller
On Github, I can send a page link with a file of code. Does
https://github.com/LearnBoost/Socket.IO/tree/master/lib/vendor It can jump to another repository
https://github.com/jtauber/django-notification It doesn't say anything about installing. How do I import it? What do
Using http://github.com/archiloque/rest-client When posting a file using this line, the content type is set
I've been trying to install Shoulda script/plugin install git://github.com/thoughtbot/shoulda.git but all I get is:
I am developing some school grading software and decided to use Github to host
Is there a way to entirely remove a directory and its history from GitHub?

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.