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

Page Speed Insights

The importance of page load speeds for website performance cannot be emphasized in the current digital environment. A website’s loading speed can make or break its success in today’s fast-paced world when people expect rapid access to information and flawless online experiences. The following are some major justifications

Redirects & Canonical. What’s The Difference?

There is a lot of confusion about the difference between setting redirects and canonicalization. Here’s the deal. What a 301 says to search engines. Hello, Mr. Search Engine. My page has has moved, permanently, to this other address. If you will please remove my old domain from your

Web Marketing Staff Training

How easy is it for one to do their own SEO? Difficulty level: 5 out of 10 If you know how to use a computer and can spare 3-5 hours per week then it is perfectly reasonable to expect you can do your own SEO and save hundreds

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?

Howe Development Has a New Website

Website is complete on Howe Development. Now for phase 2 – integrating a simply, custom CMS so they can update content on parts of the site. No need for wordpress – we can easily do a custom solution for those cases where a client only needs to control

reducing cumulative layout shift (CLS)

Reducing Cumulative Layout Shift (CLS)

NEED HELP REDUCING CLS? Enter Your Website Below For Personal Recommendations:   Fill out my online form. In the fast-evolving landscape of web design, one metric that has gained significant attention among developers and SEO experts alike is the Cumulative Layout Shift (CLS). Since it directly affects user