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.

More Web Design Blog Content

Theo Has A New Website

Theo’s Lawn Maintenance worked out a sweet deal with Livewire and we’ve been helping them do some of the SEO and web work Their old design was working fine but needed just a little pizazz and a contact form upgrade. We gladly complied and set them up in

Learning how to code?

We get questions all the time about how we started doing all this. Where did we learn to code? How on earth does any of that make sense? Some people are interested in learning for themselves. It’s easy to get started, especially in this day and age. Back

Submit A Sitemap … To Bing?

Indeed. For some reason, Bing still exists. And since it does you’ll need to submit your sitemap so your business will show up in the results of a person who searches from the unwanted automatically installed Bing bar on their browser. They’re so lovely, forcing it on you

CSS3

Lots of new fun with CSS3. CSS makes styling web pages a snap. Now CSS3, the third “version”,  allows for incredibly robust styling possible. For instance, background gradients are a breeze when before developers had to create them as images or use CSS ‘hacks’ to accomplish those goals.

Why are most government websites so terrible?

The recent debacle with the Affordable Care Act has made headlines but those of us in the development world are just seeing more of the same old thing. Government websites stink! Why is that? I can assure you that their cost structure is very similar to the outrageous