Script Perfect

         Random snips of code and bugs

Archive for the ‘JavaScript’ Category

Basic Auto Suggest with Ajax and PHP

Posted by Tim On September - 11 - 2009

ajax auto suggestYou see it in Yahoo, Google, Bing, and all over the web. As you type into a search feild a box appears before your eyes showing you suggestions based on what you are typing. This offers more than just ease of use for your visitors, it allows them to see other content related to their search that they may have been otherwise unaware of. There are many tutorials on this subject, many of which rely heavily on API’s or copyright protected files.

Developing an auto suggest form is rather simple, with the right methods you too can churn out a professional looking auto suggest form without the complicated mess that many others provide.  Visitors are likely to return to your site (provided the content is valid) to use features like this because so many other sites are slow in developing this type of technology.

The concept is simple, we run a JavaScript function every time a user presses a key in a search box, we use Ajax to send and receive data to a php search function and return the results to our page.

Read the rest of this entry »

JQuery UI vs. Scriptaculous

Posted by Tim On September - 10 - 2009

scriptaculous vs jquery uiDoll up your website with great effects and widgets by using JQuery UI or Script.aculo.us. It is becoming easier and easier these days to impliment all sorts of effects to your site with just a few lines of code.  One question many people have is which one of these interfaces reigns supreme over the other? The answer is not really that simple considering how many different flavors of designers, code monkeys, and developers there are today.

There has always been a huge argument over the file size when using any plugin… “In the left corner weighing in at 450.5KB is JQuery UI! In the right corner weighing in at 621KB is Scriptaculous!”. It does not seem like that big of a difference, I mean we are only talking about 17oKB difference between the two.  If we were to minimize both of these files and enable file compression on our servers I doubt you could even notice a difference on a good 56KB modem connection. So what are the benefits of using one over another?

Read the rest of this entry »

Ajax – A Squeeky Clean Website

Posted by Tim On September - 8 - 2009

Ajax, not the cleaner, the asynchronous JavaScript and XML, it is like viagra for your website. Pop in a little Ajax and your website is performing better and making your “visitors” happy. As with viagra you need to read the warning labels associated with Ajax.

Warning:

Ajax should be used in moderation. If your server maintains a full load for more than 4 hours as a result of using Ajax, you should consult a programmer immediately. Websites hosted on shared servers or those intending to move to a shared server should not use Ajax as this may cause complications during deployment.

Seriously though, over use of Ajax can cause a lot of load on your server if you are processing too many requests at the same time, often the requests that tax the server the most include database queries. Don’t get me wrong, I love Ajax and I think every site could put it to good use. This is why I am going to show you a few simple methods to implement it on your site to make your visitors time more enjoyable.

Read the rest of this entry »

PHP File Upload Progress (APC Fetch PECL)

Posted by Tim On September - 4 - 2009

You would think that tracking file upload progress would be a given now, from your browser you can create websites, edit pictures and communicate with millions of people. Only a few sites will actually show you your upload progress and they are few and far between. If anything they will show you a nice animated gif that gives you the illusion your file is being transferred.

It is very possible to track upload progress but I have some bad news for some of you. If you are hosted on a shared server like Hostmonster, BlueHost, etc… then odds are you will not have the right privileges to install the required modules. For those of you that have access to your own server or the capability to get it installed then read on.

Read the rest of this entry »

Easy LightBox With Scriptaculous and Javascript

Posted by Tim On September - 2 - 2009

Lightbox
I searched far and wide to find a basic lightbox that was not only lightweight but easy to install. It was just one of those nice touches I wanted to add to my site but did not want to spend a lot of time doing so. Needless to say I could not find a simple solution so I spent some time and made my own.

This is broken down into a few small and simple sections, first the CSS which we will use to display our lightbox followed by the HTML and Javascript to activate it. In order for this to work correctly you must have script.aculo.us set up on your site.

A working demo may be seen by clicking here.
Read the rest of this entry »

About Me

I am an independent web developer and webmaster of many sites. The main goal of Script Perfect is to provide answers to some of the hard to find questions when it comes to website design and coding.

Twitter