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

WordPress Experts: Getting Slug by Single_Cat_Title

An interesting problem that I came across in a recent project. The client needed a custom post taxonomy set to a gallery of choices on a featured section of their website. First we needed to add custom post types and category images plugins. Iterating through the taxonomy was

The Amazon Dams Network

Proud to present the first online version of the Amazon Dams Network. This has been a project Livewire has been working on for several months with the University of Florida and other members from around the world. This has been a very exciting project and we are pleased

New Beginnings: Mcgriff WIlliams Insurance

New clients start today: Mcgriff Williams Insurance has decided to start a new campaign for online insurance quotes. We’ll be providing a key marketing role with their new website: INSURENCY.com They have the very latest in online quotes and are attempting to break into a heavily saturated market

web design ocala fl

Why Local Web Design Matters for Your Ocala Business

In today’s digital age, having a professional website isn’t just an option—it’s a necessity. But not all websites are created equal, especially when it comes to local businesses. If your business is based in Ocala, FL, choosing a local web design company like Livewire can make all the