tags:

views:

87

answers:

1

Home.html

I have a left menu in which when visitor menu is clicked, it will load visitor.html in the div named 'rightcont'.

$(".rightcont").load("visitor.html");

Also when the students menu is clicked, it will load students.html on the div rightcont

$(".rightcont").load("students.html");

But by default i loaded welcome.html in the rightcont when the page is first visited.

My problem is when the user click a link named STUDENTS in some other part of the website, it redirects to home.html in which the 'rightcont' div displays welcome.html. I need rightcont to display students.html.

How to change it dynamically based on the link clicked

A: 

Use:

return false;

to make sure that when clicking the link it doesn't redirect the page. You can load the div rightcont when the link is clicked.

$("#students").click(function() {
    $(".rightcont").load("students.html");
    return false;
});

(You need to have id="students" in the anchor tag to make that selector work)

jjclarkson
But the students link and rightcont is in different page, thats the page.........
Rajasekar
You need to pass some variable from the source page, either in a post or injected into the target page.
jjclarkson