Jump to content

AJAX dropdown to populate html form for GET request


anderson_catchme

Recommended Posts

Hello forum,

 

So I've been developing an app mostly in PHP, but am rather afraid of JS. Hope to fix that.

 

I have an AJAX dropdown using JQuery to search locations. It works great. However, I want to make it similar to what is seen on this site:

 

http://placefinder.com/

 

As you can see, the dropdown, when clicked populates a box. Then the user submits the form and the data is used in the application.

 

I have no clue how to make the form populate with data from the DB (I'm using mySQL) when clicked. So far, I've only been able to make it clickable as a URL (not what I want, obvioiusly!)

 

Is there a way to do this on a really small, simple script for starters? I'm certain their is, but don't even know where to begin.

 

Any help appreciated :)

Link to comment
Share on other sites

Do you mean the text box in the center that starts to populate some options as you type?

 

If so, that's called an autocompleter. You can search for it or use something like from jQueryUI.

http://jqueryui.com/autocomplete/

 

You'd just use "function" as the source and trigger an ajax call that hits a certain URL on your server. Then have your script query the db and return results back which then get populated in the "dropdown".

Edited by CroNiX
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.