This snippet uses jQuery - an excellent little piece of Javascript that makes this sort of trickery relatively simple.
Firstly, have a look at the basic syntax here: jquery.com/docs/ajax
A couple of things that I stumbled on:
- Content loaded via the .load call doesn't have any event handlers attached, so in the Callback function you need to use .find() to look for any elements you want to assign events to.
- Getting the ID of the element clicked ended up being pretty simple: this.id
- Getting the value of a form field involves a simple walk around the DOM - as the form isn't actually "Submitted" - use document.GetElementById("fieldID").value
Then you should end up with something more-or-less like this:
[syntax,ahah-jquery.js,javascript]
See it in use here: glenfosslyn.com.au/pages/2006-sale (This is a work in progress - it may or may not be working at the time you visit!)
No comments:
Post a Comment