Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Learning AJAX by example?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
Seeing how there is liitle/no activity on the Ajax forum, I am reposting this here:

Gents;

I've been struggling with this for literally months and cannot seem to get a handle on it. I am a seasoned developer but not that familiar with js. I've spent the last several days (yes - many, many days over months) searching for examples and have found many but not what I believe would be a simple solid example.

I am trying to use the onchange attribute of an html <select> statement so the selected item will trigger a js script to communicate with a server via XMLHttpRequest then accept the returned content and populate a target select section.
I do have a working host module that returns a json encoded string with the desired content. In fact, here it is:

{"*A":"*ALL","C5":"Cash 5","L":"Classic Lotto","P3E":"Play 3","P3M":"Midday 3","P4E":"Play 4","P4M":"Midday 4","PB":"Powerball"}

I've played with many many variations of js code in my test php program/js content without success.

I am HOPING that someone here can reference a simple set of js scripts that will:

1) generate an XMLHttpRequest based on the value selected by the user on the first select/option set;

2) parse the returned json content and re-populate the target select/option set then enable the select itself.

Someone, somewhere must have this logic or at least know where to find good examples?

I do have several javascript books as well as access to much online js content. And, an example is worth a thousand words (or days in my case).

Thanks to ANYONE who can provide this example or a reference thereof.

B ponder
 
If you are indeed a seasoned developer, the tutorial at w3schools should be all you need...you must read through all of it, not just skim it and go to the pages/sections you need. Take the time (it takes under 1 hour) to read through it all and understand how it all works. Go through the examles and try them out...




--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Thanks, vicvirk;

It turns out my basic understanding of ajax was OK and I have already been through the w3schools tutorials. Using Firebug I was able to trace the issue to some invalid javascipt syntax which was causing failure AFTER the return and capture of the host response.

Thanks anyway.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top