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.

Leave a Reply

NOTE: fields marked with an asterisk * are required.





skip to top of page

Currently Reading

Information and Data Modelling (Second Edition) by David Benyon (Cover)With an eye toward implementing another web interface database solution from the ground up I'm casually revisiting David Benyon's Information and Data Modelling (Second Edition). Its critical to have a solid understanding of conceptual data modelling and knowing how to identify various things like fan traps and three way traps very early in the process. To that end, while its fine to have a basic understanding of third normal form and general ideas about relations (that which relational databases rely on), its also a great idea to spend time exploring the theory and case studies that lead to a higher understanding.

Often people I deal with just snuff their nose and say they can design a database - but often its a very naive approach. Having read this book about four years ago its time for a quick refresher over my holiday period. No, I doubt few will envy me.