AJAX Form Tutorial

This tutorial will show you how to create an AJAX form with PHP and jQuery. The AJAX form doesn’t look any different to an ordinary HTML form, with the exception of making sure that when we submit the form, it calls a javascript function rather than pushes the user to a page (causing a new page reload). I’ll also demonstrate how we can use ‘loading’ animation for the AJAX form, whilst we wait for the server to respond. Read More…

Posted in AJAX, JavaScript, jQuery, PHP at October 12th, 2010. 2 Comments.

How to Create a Textarea Character Counter / Limiter Using jQuery

Need to limit the number of characters that are allowed to be entered into a textarea? I’ve crafted a little snippet that you can drop into your projects to achieve just that! It also provides a counter to the user, showing how many characters are remaining as they type.

This could be extended pretty easily, so that it works on multiple textareas, or even as a jQuery plugin. Read More…

Posted in JavaScript, jQuery at October 4th, 2010. 7 Comments.

How to Convert PHP Multidimensional Array to Javascript Object (using jQuery)

I was working on a project today, and I needed to convert a PHP based multidimensional array into a Javascript array, so that I could use it for a dynamic select dropdown (depending on the top level category chosen, the next level select dropdown would be populated with the child elements of the top level category options – if you follow me!).

Anyway, I soon realised that converting the PHP array into a Javascript array was a bad idea, as converting it to a Javascript object would be much much better.
Read More…

Posted in JavaScript, jQuery, PHP at September 29th, 2010. 8 Comments.

Beginner’s Guide to Writing a jQuery Plugin

Lots of tutorials coming up in the next few days – seeing as you guys are actually enjoying them! This is a really simple tutorial on how to write a jQuery plugin. It’s also a usable “Default Text” plugin, which sets some preset text in a form input, which clears when you focus the fiels.

It’s not as comprehensive as some other articles out there, as I wanted to keep this nice and simple. If you’re like me, you just want the simple tutorial – as you’ll enjoy building on it in the future!
Read More…

Posted in JavaScript, jQuery, Plugins at August 19th, 2010. 3 Comments.

Solution to Form Submit 403 Error

Have you ever had a problem where you get a HTTP 403 error from submitting a form?
Does this form have a field that submits a URL?

If yes to the above two questions, I think I know the problem you’re having, and have a solution. It’s to do with mod_security (an Apache module) and the ‘http://’ part of the URL.

Read More…

Posted in JavaScript at February 10th, 2009. 3 Comments.