From the working samples we've done so far with
.getJSON, you can probably think of many extremely cool ways to implement AJAX in your WordPress site. The most useful application of this is the comment form.
First up, we don't even need to amend any template page HTML or WordPress Template Tag, PHP code. This is great as again, as often as possible (all the time really) we always want our site to work without the jQuery enhancement.
Ajaxing the WordPress comment form is deceptively simple. And for you "premium" theme developers, it's a great way to entice people to download your theme: "Built in AJAX comments!". It is something that we'd like full control over, so we'll be using the
.ajax() function instead of
.load (see, I told you
.ajax would come in handy every now and then).
First off, in experimenting with the comment form, we'll be wanting to change its CSS properties to alert users to errors. I've found it's just better to set...