Skip to content

Instantly share code, notes, and snippets.

@attomos
Created January 9, 2012 09:02
Show Gist options
  • Save attomos/1582071 to your computer and use it in GitHub Desktop.
Save attomos/1582071 to your computer and use it in GitHub Desktop.
Call javascript function from PHP
<script>
function a() {
alert("This is msg.");
}
</script>
<?php
$a = 1;
if ($a == 2) {
} else {
echo '<script>',
'a();',
'</script>';
}
?>
@avatar-lavventura
Copy link

This does not work for the async JavaScript function calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment