Skip to content Skip to sidebar Skip to footer

Ajax, Javascript Send Variable To Another Page, On Click

Lests say I have a basic loop: **$page = 'unique value which changes every time it counts, it loops';**

Solution 1:

ok,from what i understand, you need a javascript function binded on the onclick event of the generated links that sends you back to a different page the link content. if that's what you need, i recommend using a library such as jquery (it's more easy ti use) and paste this code into the page:
$('a').click(function(){
$.post("url_of_the_page_you_want_to_send",
{data : $(this).html()}); });

hope this helps :|


Solution 2:

I think you are talking about the get variables

Try this.

<a href="http://www.mysite.com/page.php?page=<? echo $page; ?>">Link<? echo $count; ?></a>

and you can get the value of $page variable in page.php like this

echo $_GET['page']

Post a Comment for "Ajax, Javascript Send Variable To Another Page, On Click"