Web Development » Ajax: A simple approach that you will use and reuse

Ajax: A simple approach that you will use and reuse

One great element of user interface and improving the customer’s experience on your site is providing them with helpful feedback during their experience. We most often see examples of this in form validation, whether it’s a sign up form with email validation or during the checkout process on an ecommerce site – it’s nice to let the user know that what they did was correct or quickly let them know they need to make changes so their time is not wasted and their patience are not tested. Here’s is a very simple, but very versatile, example utilzing jquery, php and ajax to provide instant feedback to your guest.

Note: my approach uses the jQuery.post() method, which is equivalent to jQuery.ajax(). Learn more about jQuery.post().

Snipplr Code

Here’s the accompanying php:

Snipplr Code

And here’s a little demo I threw together to show an example of this in action. (sorry the demo is currently unavailable while I'm rebuilding the site!)

Comments