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 :)

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".

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.