Javascript called by PHP

Interesting little snippet.

What is going on here? Livewire gives you the low down.


 if($num_rowvs == 0){
 echo '<script>// <![CDATA[
alert("This is an alert message. I'm alerting you that you are totally awesome!");
// ]]></script>'; }


First, we’re creating a simple if statement in PHP.  Not entirely necessary, but prbobably the most common setup. Next we’re simply echoing the javascript alert – make sure to get your apostrophes and commas straight.

And that is it. Close out the tags and you have successfully called a javascript alert from inside PHP. Congrats.

Hey, Look What We Did…

Our programmers are the best in the business. We just finished a great new project at This service connects lawyers with lawyers that pay

Read More »