jQuery – Ajax Tutorials PHP

jQuery Dependent DropDown List – States and Districts

In this tutorial we are going to see how to change district dropdown list option based on the selected state name.

For Localhost create a database with name demos and import the sql file available inside download package.

View Demo

In this example, we have two dropdown for listing states and districts. On changing states dorpdown values, the corresponding district dropdown values will be loaded dynamically using jQuery AJAX.

HTML Code for state and dsitrict dropdown

Getting States using jQuery AJAX

This script contains function that will be called on changing state dropdown values. It will send AJAX request to a PHP page to get corresponding district dropdown options.

 Read State Database using PHP

This PHP code connects database to retrieve district table values based on the country id passed by jQuery AJAX call.

For Localhost create a database with name demos and import the sql file available inside download package.

View Demo
Download Source Code(JQuery Dependent DropDown List – States And Districts)
Size: 33.3 KB
Version: V 1.1

About the author

Anuj kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.

Leave a Comment

2 Comments

Subscribe For Latest Updates