Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Page refresh cannot happen so AJAX I think?

    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.

  • #2
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    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.

  • #3
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    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
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #4
    New Coder
    Join Date
    Nov 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •