Loading html dynamically using Javascript and PHP
Posted
by Vafello
on Stack Overflow
See other posts from Stack Overflow
or by Vafello
Published on 2010-04-14T22:04:07Z
Indexed on
2010/04/14
22:13 UTC
Read the original article
Hit count: 292
I have the following code:
<?php
if ($x == 1){
?>
<b>Some html...</b>
<?php
}
else if ($x==2){ ?>
<b> Other html...</b>
<?php
}
?>
Now I would like to have two links below (a href) and somehow pass the variable $x (so Link1 passes x=1 and Link2 passes x=2) in order to load the relevant bit of code from if statement. I know I can pass $x using form and then test its value and load required bit of code, but I would like to do it smoothly, without reloading the page. I think that JQuery could help it, but I have no idea how to do it. Any ideas greatly appreciated.
© Stack Overflow or respective owner