...

Page refresh cannot happen so AJAX I think?

Jim Nayzium
08-07-2007, 02:19 PM
I am new to AJAX, but my hunch is with javascript and ajax I can accomplish what I want to do ...

I have a form that users fill out to write reviews of audio gear. When they select the manufacturer, these are pulled from the database through a drop down list.

Next to that drop down currently I have 'add a manufacturer' link that takes them to the page that adds the manufacturer to the drop down if its not there...bad news is, this refreshes their current page so it will load the new drop down...which makes them lose the information they have entered...

So the straight forward solution is to force them to add the manufacturer first and have a two page submission...

But I thought there would be a sexier way to do this via AJAX or javascript....

So to recap, I would like to update the contents of a drop down list pulled from the database without refreshing the entire page?

Is this possible?

Thanks.

mic2100
08-07-2007, 02:28 PM
yeah this is possible but i am at work now, if you are still struggling when i get back later i will help you achieve this.

A1ien51
08-07-2007, 02:31 PM
Can you do it? Yes you can do it. Here is the basic idea:

You can show a hidden div on the page that has a textbox: onclick='document.getElementById("someId").style.display="block";'

You can find any Ajax tutotrial that shows you how to post data to the server. Have the server return the new value and use new Option(text,value) to addd the item to the list and hide your div. document.getElementById("someId").style.display="none";

Eric

Jim Nayzium
08-07-2007, 06:51 PM
i do understand how to hide divs...so i guess i need help on the ajax part...i will search -- please assume i have struggled and will post here as soon as i find solution



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum