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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:25:17+00:00 2026-05-19T04:25:17+00:00

I can’t figure out how to add the history plugin functionality to my (really

  • 0

I can’t figure out how to add the history plugin functionality to my (really simple) ajax code.

Here’s my code so far:

$(function() {

    $.ajaxSetup({ cache: true });
    var hijax = $('ul.hijax a');
    var loader = $('<div id="spinner"></div>');
    hijax.click(function(e){
      hijax.removeClass('ajax-on');
        $(this).addClass('ajax-on');
        var url = $(this).attr('href') + ' #biog-container';
        $("#ajax-container").html(loader).load(url);
        e.preventDefault();
    });
});

This pulls the contents of the the linked page containing a div with an id of ‘biog-containers’ (The is a list of names with links to peoples’ biographies – it’s a site for a baroque orchestra!).

The ajax calls works great (yay jQuery!), but I’ve googled and googled about adding support for the history plugin and (stupid front-end guy that I am) I just can’t figure it out.

Thanks for the help.

  • 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-19T04:25:17+00:00Added an answer on May 19, 2026 at 4:25 am

    You can create a global array, holding the items clicked though the script. Push the elements at each click, but have present the last item WON’T be return item.

    At a return point, check if your array has more than one item, pull one item and discard it (that item represents the current page), pull another item and trigger a click over it.

    This code is not tested!:

    $(function() {
        var links = new Array(),
        hijax = $('ul.hijax a'),
        loader = $('<div id="spinner"></div>'),
        container = $('#ajax-container'),
        content = container.html();
    
        $.ajaxSetup({ cache: true });
    
        hijax.click(function(e){
            var $this = $(this),
            url = $this.attr('href') + ' #biog-container';
    
            e.preventDefault();
            links.push($this);
    
            hijax.removeClass('ajax-on');
            $this.addClass('ajax-on');
            container.html(loader).load(url);
        });
    
        $('#back-button').click(function(e){
            var link;
            e.preventDefault();
    
            if (links.length > 1) {
                // This represents the current link
                links.pop();
                // This represents the past link
                link = links.pop();
                link.click();
            }
            else {
                // This may be empty, or represent the current content
                links.pop();
                // Show the original content
                container.html(content);
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can I use the following across all browsers? <a href=# onclick=doSomething()>Click here.</a> Is this
Can anyone pls let me know the exact c++ code of case sensitive comparison
Can I invoke an option on a COM Add-in from a VBA macro in
Can i get the source code for a WAMP stack installer somewhere? Any help
Can somebody point me to a resource that explains how to go about having
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can you cast a List<int> to List<string> somehow? I know I could loop through
can you recommend some good ASP.NET tutorials or a good book? Should I jump
Can a LINQ enabled app run on a machine that only has the .NET

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.