Script Perfect

         Random snips of code and bugs

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 »

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 »

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