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

Facebook Dings Developers

In the ever growing app community, Facebook is putting the screws to developers looking to use their vast resources to build their apps. Really, they’re just looking for a little “reciprocity”. But come on, how much do you need? You already own and operate the largest website in

JSON and PHP

Here at Livewire, Gainesville Web Design headquarters, we have had a couple of projects recently that allowed us to work with JSON and PHP. Initially it may seem a bit strange for PHP experts to want to embed javascript functionality in their code base but the two work

Small Business Sees A Rise In Cyber Threats

Come on, let’s all live in the real world: we’re all vulnerable. Really the only chance you have these days is to make it as difficult as possible for any potential hacker to get to your valuable data. First and foremost this means protecting your data in transit.

AJAX Store Locator ★★★★★

Just finished up a project using AJAX store locator from codecanyon. The client needed a lightweight solution to locate specialty stores all across the country. With some significant upgrades, we customized this script to suit their needs exactly. Customization took around six hours but was much more efficient

Gatorland Kubota Has A New Website

A great new site for a great company with new ownership. Gatorland Kubota sells and services all kinds of farm and lawn equipment. A family owned and operated business there is no doubt that they want the best for their customers. After all, they chose livewire didn’t they?

Case Study: Rose Petals Nursery

Rose Petals Nursery is a website that we have been involved with for some time. We love the site and we love Cydney, who runs everything. Our Gainesville Website Design team create the website and we do all of the optimization. As you can see below, the site