Reputation: 663
I am passing a variable via the URL as var=5
to urlrun.php
(like urlrun.php?var=5
). There is a JavaScript function called testrun
in urlrun.php
.
Is there a way to call that JavaScript function depending on the value of that variable (var
) passed through the URL?
For example, if($_GET['var']==5)
, I need to call that JavaScript function.
Upvotes: 0
Views: 156
Reputation: 129011
Put this somewhere:
<?php if($_GET['var'] == 5) { ?>
<script type="text/javascript">
testrun();
</script>
<?php } ?>
Upvotes: 4