call specific jQuery on next page on click of a link

All about creating websites!
Post Reply
User avatar
z3r0aCc3Ss
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 700
Joined: 23 Jun 2009, 16:00
14
Contact:

call specific jQuery on next page on click of a link

Post by z3r0aCc3Ss »

I have a home page and there's a link on it.
That link should call another page. (target = "_blank")
On the second page, there's a jQuery function written. It hides/shows the content accordingly (on click). I want to call this jQuery on the click of the link on first page.
How do I achieve this? I just don't want to switch to another page, but to call a specific jQuery function after switching to the second page. There are many such functions are written on second page.


Example:
I have this code:

Code: Select all

<html>
	<head>
    	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
        <script type="text/javascript">
			$(document).ready(function(){
				$('#text1').click(function(){
						$('#showtext1').show();
						$('#showtext2').hide();
				})
				$('#text2').click(function(){
						$('#showtext2').show();
						$('#showtext1').hide();
				})
			});
		</script>
        <style type="text/css">
			.hidden
			{
				display:none;
			}
		</style>
    </head>
	<body>
    	<a href="#" id="text1">Text 1</a><br />
        <a href="#" id="text2">Text 2</a><br /><br />
        
    	<div id="showtext1" class="hidden">
        	This is text 1. How are you today?
        </div>
        <div id="showtext2" class="hidden">
        	This is text 2. I hope you are doing good.
        </div>
    </body>
</html>
This code displays no text data on load. When you click on links, it shows data accordingly.
On click of "text1", it shows different text and on click of "text2", it shows a different text.
This is easily achievable, when you are on the same page.
I want to call what is there in "text1" id, from a different page. Similarly, I want to call what's there in "text2" id, from a different page. So, the content changes dynamically. How do I do that?
Beta tester for major RATs, all kinds of stealers and keyloggers.
Learning NMAP

User avatar
CommonStray
Forum Assassin
Forum Assassin
Posts: 1215
Joined: 20 Aug 2005, 16:00
18

Re: call specific jQuery on next page on click of a link

Post by CommonStray »

Use a cookie, or HTML5 storage.

Post Reply