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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:50:28+00:00 2026-05-31T11:50:28+00:00

I have a navigation system that I wanted to make compatible with both javascript

  • 0

I have a navigation system that I wanted to make compatible with both javascript disabled clients and Ajax capable ones.
for now I have dynamic links like “index.php?page=/cat/page.php” generated inside navigation.

<li id="sidebaritem"><a href="index.php?page=<?php echo "$dirArray[$index]/$subdirArray[$subindex]"; echo $title; ?></a></li>

so when index has “page” variable, it loads that page inside main container.

but I also like to make it load onclick with ajax(jquery included). so I added this code:

$(document).ready(function(){
  $('li #sidebaritem').click(function() {
    //Page Load code goes here
    });
});

This is not working, because as I click the link, right after li->click occurs it redirects to page which Anchor tag is pointing to(of course it dose).

I had spent some time looking for a tutorial on this subject but I found nothing useful.

How can I make it work?
Is this good from SEO Point of view?
I saw this article using hash, Is this good for SEO and if it is how can I make it work on Java Disabled machines?

Sorry for poor English, I’m new in this subject and I’m learning as I go.

  • 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-31T11:50:29+00:00Added an answer on May 31, 2026 at 11:50 am

    First of all Java and JavaScript are two separate things and you’re working with JavaScript. Second of all you should replace id=”sidebaritem” with class=”sidebaritem” unless the id’s are unique, but from your given code I don’t think it is. Also in jQuery and CSS (which is where the selectors are coming from) if you use li space #id it means that you’re trying to select a child element of li with an id #sidebaritem. So you might do li#sidebaritem or if the id’s aren’t unique li.sidebaritem

    So you should try:

    <li class="sidebaritem"><a href="index.php?page=<?php echo "$dirArray[$index]/$subdirArray[$subindex]"; echo $title; ?></a></li>
    

    and

    $(document).ready(function(){
      $('li.sidebaritem a').click(function() {
         $("#your-main-container").load($(this).attr('href'));
         return false; //prevent click from redirection
      });
    });
    

    About the SEO part:

    These links aren’t SEO friendly, because they don’t contain the keywords of the title/description of your page (As far as I can tell). To improve the site performance in search engines you’ll need to replace these with something like /cat/this-is-my-amazing-seo-friendly-page/. So you might want to replace the url (which will be rendered from the title) of the page into a SEO friendly . Here’s a little snippet of code that will do the job.

    function replaceLink($url) {
          $url = preg_replace("/[^a-zA-Z0-9\-\s]/", '', $url); //find any other symbols than letters or numbers and replace them with an empty string
          $url = preg_replace("/\s+/", '-', $url); //find all spaces and replace them with a dash
          return $url;
        }
    

    So if you’ve got a page title: This is my amazing SEO friendly page pass it into this little function like this:

    $link = replaceLink("This is my amazing SEO friendly page");
    

    and you’ll get This-is-my-amazing-SEO-friendly-page

    Obviously this is just one of the basics for improving On-site SEO. You can read more about On-site seo here

    Also. From the search engine perspective your AJAX page load will have no impact as long as the real links are specified in the menu and they work without JavaScript enabled.

    Hope this helps

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

Sidebar

Related Questions

I have a navigation system that provides a permalink for any link setup. When
I have a simple navigation system in a sidebar on a page that you
I'm building a navigation system using jquery scrollto. I have my navigation menu in
I'm new to AS3 and have been working on an XML driven navigation system
I have a navigation view with a cell that has something as simple as
I have a navigation bar that has two dropdowns (as nested ul's). I'm trying
I've written a kind of navigation system for pedestrians. The only thing is, that
Im writing an app that has a navigation controller as it's main menu system
I am developing a WordPress page that uses a jquery.slideto.js navigation system and html
I have jqgrid and in that I have one custom navigation button to export

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.