skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Basic Question for Ajax Gurus

I’m working on upgrading a contact form tonight to include simple Ajax functionality within a WordPress theme. Its actually the Ajax from Chapter 5 of Jeremy Keith’s Bulletproof Ajax and my own contact form and server side processing. Not for this site though.

What I’ve done is probably a bit of a fudge. Like Jeremy’s model the String saying required is inserted into the form labels of fields that don’t have content, that’s easy enough. And the string is returned to the form via simple URL encoding (don’t ask me why I tacked it on that way). Yes the URL encoding actually just identifies label X to say required. Not a big deal. My apologies for not showing you but its located on an intranet behind a proxy firewall.

The Ajax works (in a fashion) and thanks to Jeremy’s code for that one. But there’s also an issue that’s got me scratching my head. And its got me wondering if any Ajax gurus might be passing tonight willing to offer a word of advice to a self-confessed JavaScript kludge.

The problem is that form submissions are going in and then the Ajax is inserting an entire new page into the #content div, not just updating the form labels to show required. If that makes sense? Now, my question is twofold. Why is this returning the whole page? And, more importantly, how would I subvert that to only return the necessary form? Because I thought it was going to do exactly that.

Articles are licenced under a Creative Commons Licence but copyright of images is retained by © Steven Clark 2007 - 2008

One Response to “Basic Question for Ajax Gurus”

  1. steven

    Ha ha ha that’s the trouble when you’re doing a huge amount of Quality Assurance (about 12 to 16 hours on five huge forms of radio button selections for some reason kept in case statements - don’t ask me why - of a different list for each possible selection). The QA, my paid work and then trying to work on the Ajax.

    So nobody threw stones… but then if I’m calling an entire page into the #content div then of course I’m getting a page within a page (a bit red sorry).

    Rewrite the PHP and I’ll be away… problem solvered.

skip to top of page

Currently Reading

Andy Clarke's Transcending CSS: the fine art of web design has been sitting on my bookshelf for several months and I've finally made the time to read it from end to end. My favourite thing about this book from the outset is that it's a designer's book, rather than a technician's manual, for web designers. The artwork and direction in Transcending CSS is enhanced by the attention to detail in the feel and texture of the book itself, the size of it's pages and the feel of the cover in your hands. It's definately a book that affords the act of being read. Looking forward to it.