Forum Moderators: phranque
Ajax ideas [webmasterworld.com]
Ajax and AdSense [webmasterworld.com]
Thanks to isorg and Bernard Marx for thier contributions, which helped me hit the ground running. Over the weekend I was toying around and came up with a simple use for this technology on one of my own pages, letting users pick their city (if available) from a drop down list. It's not much more than demo piece, avoiding any real breakthroughs.
There are a few issues I encountered, and so hopefully some of these have already been addressed. First, I cannot validate this page. Maybe I need to use a different dtd? Currently I'm using the HTML 4.01 Transitional DTD. The problem arises with the javascript source. If placed in the head of the document then the javascript fails to select anything from the drop down. To overcome that I placed the source right at the point where it gets used, but at the expense of invalid markup.
Other javascript on the page seems to cause interference. Nothing definite on this point, but specifically having G's AdSense code in between the js source file and the actual drop down list seemed to cause problems with the list. This doesn't make a lot of sense, and may in fact relate to the earlier problem of having the js source in the document head.
CSS styling seems like it will be a big factor in any list oriented use of AJAX. My list drops to show four options, and if there are more than four, the user scrolls thru the list. However, the next line (below city) is for input of State and Zip Code. Right now I have a big ugly 4 line gap between the city and state. I'm pretty sure that with a little CSS magic I can remove this gap.
So far I can type a customer name into the text box, and select from a list matching the typed text. That's pretty slick. I'm cheating a little from that point, because I submit the form to retrieve the customer info from the database and re-display the filled form.
What I've almost been able to complete to to have all the form fields filled in without using the form submit. The best that I've been able to manage is to pre-fill the fields with the customer id (using js) and then as I tab thru each field, the correct value for that field (address, city, state..) will be available from a select option. It's ugly and clumbsy, but I think, a step forward. I'm feeling a bit alone out here, is no one else trying to use this stuff?