how to pass a php var through jquery?
i have this script on JsFiddle .
when i click on the links i get another view.
What i am trying to do is replace
<a id="mine_click" href="#">test</a>
with:
$test = 'here we go'
<a id="mine_click" href="?var=$test">test</a>
and pass the $test
var to the tab3
view when i click on the test
link,
so th开发者_如何学Cat the result will be 2222 here we go
any ideas on how to pass a php var through a link going through jquery?
thanks
I'm not sure that it is exactly what you need.
You have a php variable from the server side. In your javascript code you can do
var foo = '<?php echo $test; ?>';
and then you can use foo
as a javascript variable
$('#mine_click').attr('href','?var='+foo);
You could do:
var test = '<?php echo($test) ?>';
$('#mine_click').attr('href', '?var='+test);
?var=<?php echo $test; ?>
will do the stuff
$('#mine_click').attr('href', '?var=<?php echo $test; ?>');
精彩评论