JavaScript AJAX Basics (retiring) jQuery and AJAX Posting Data with jQuery

passing variable and getting the result.

I was wondering how can i use postal code text field and get result based on filled in postal code, from another server, while i display the result in a div. The reason i ask for a postal code, is i have a long form but just want to use postal code or house no, text field on finding correct address via that?

Tommy May
Tommy May
12,056 Points

Hi Ammar if I understand your question you want to use a form to capture a users zip code. Then use that captured postal code to automatically display the city and state?

If this is your question I would suggest looking into reverse geocoding. You will need to use an api to accomplish what you want easily. Google has an api you can use with examples on how to use it. https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse

Hope this helps.

Tommy May I will look into it, one of reason to my post is to find out, on how to send whole or selected form data as we do for normal ones like fname = $_POST['firstname'] etc. The course or video didn't cover that, as i think serialize() is something but it won't do much good.