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
Ethics honesty and integrity words on signpost

Honesty & Integrity in Business: The Foundation of Long-Term Success

In today’s fast-paced digital world, businesses are constantly competing for attention, customers, and growth. Some companies take shortcuts, making promises they can’t keep, or worse, engaging in dishonest behavior that prioritizes profit over integrity. At Livewire, we believe that honesty, transparency, and strong core values are the key

Neon AI on a keyboard

How Contractors Can Use AI to Work Smarter, Not Harder

Brought to you by Livewire – Web Design and Digital Solutions for Contractors In an industry where time is money and efficiency is key, artificial intelligence (AI) is no longer just a tech buzzword—it’s a practical tool that forward-thinking contractors are starting to use every day. From saving

Don’t Get Smacked by Copyright Infringemnt

Developers do it all the time – they need an image for a website and head on over to Google images, put a keyword in and voila! Free pictures for everyone! Not so fast. Many of these images are protected under copyright law and if you get caught,

A Little ZipBamBoom From Livewire and You’re #1

Performance Transmission came to us in need of a Gainesville SEO Expert. Luckily, we have one of those and loan him out on occasion. They had tried other SEO tactics and were just not seeing the results they needed. No matter what they were doing they couldn’t jawbone

Minimalism in Design

By eliminating clutter and concentrating on essential features, minimalist web design prioritizes user experience. This method prioritizes an uncomplicated and aesthetically pleasant user experience by utilizing clean lines, plenty of white space, and a minimal color palette. Minimalist websites accomplish these goals by reducing unnecessary design features, which

Florida Auctioneers Has A New Website

Proud to present the new and improved Florida Auctioneers Association Website! This was a lengthy project but the final website is well worth it. Really more of a web portal, the system is chock full of features and runs smooth and fast. The site features: Membership program Member