tags:

views:

67

answers:

2

my php code will check after a condition. if the condition is true i want it to trigger a jquery code that displays a box.

i wonder how i can trigger a jquery code with php?

+1  A: 

Output the jQuery code into the page using PHP. PHP runs server-side, jQuery runs client-side, after all of the PHP code has already executed and the page has been sent to the browser. They don't directly talk; one writes the other.

Amber
+3  A: 

Well, you could only trigger it on page load. The way you would do that is by using PHP to write some javascript:

<?php
 if($some_condition) {
  echo '<script>var executeCode = true;</script>';
 }
?>
Mark