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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:39:49+00:00 2026-05-28T02:39:49+00:00

Here an example of my code, which when user click a link then it

  • 0

Here an example of my code, which when user click a link then it will load a specific content id and will show default content if there have no click action into #content div

$(document).ready(function () {
    $.ajaxSetup({
        cache: false
    });
    $("a.view").live('click', function (e) {
        var id = $(this).data("id");
        $('#content').load("content.php?" + id);
        e.preventDefault();
    });
    $('#content').load("content.php");
});

Question, how to load a content automatically when user using direct link or type in url bar : example http://domain.com/content.php?id=5

So if user type or using direct link I want script doing exactly like .live('click') and load the current id example is 5

Let me know.

  • 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-28T02:39:49+00:00Added an answer on May 28, 2026 at 2:39 am

    Using your example, you’ll need an anchor to bind to:

    <a href="#" data-id="5" class="view">Some Link</a>
    

    Then the code should work as follows:

    $(function(){
      // bind to current and future anchors with the "view" class applied
      $('a.view').live('click',function(){
        // grab the content and load it in to the container
        $('#container').load('content.php?id=' + $(this).data('id'));
        // return false so it doesn't follow the link
        return false;
      });
    
      // also load the default content (before any click event)
      $('#container').load('defaultContent.php');
    });
    

    However, if you’re looking for a seamless (and SEO acceptable) content page, I would look in to using the hashbang syntax: What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for?

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

Sidebar

Related Questions

Is there a way to execute internal code via reflection? Here is an example
Given the following HTML structure: <div class=wrapper> <div class=top> <a href=http://example.com class=link>click here</a> </div>
here is my example code: Public Class Parent Private _TestProperty As String Private WithEvents
Here's some example code: class Obj attr :c, true def == that p '=='
I'm looking for something like break for loops. Here's some example code (using Symfony's
Here is an example of my code in a DAL. All calls to the
Here is my current code: RewriteCond %{HTTP_HOST} !^example\.com [NC] #RewriteCond %{REQUEST_URI}!^something RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com
For example, my goal is to test the code given here: PHP script that
To use a contrived example in Java, here's the code: enum Commands{ Save(S); File(F);
Im using the color picker here: http://blog.meta100.com/post/600571131/mcolorpicker Im using code shown in example 3.

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.