Codeigniter Dependent country state city dropdown using jQuery Ajax with MySQL

In this tutorial, I am going to explain the dynamic dependent country state and city dropdown using jQuery Ajax in Codeigniter and MySQL. Dynamic dependent select box is used to implement country state city dropdown functionality. Using jQuery Ajax in Codeigniter and MySQL, you can easily implement a dynamic dependent dropdown without page refresh. We will cover this tutorial in easy steps with a live demo to develop a complete dynamic dependent dropdown. We will also provide to download source code of the live demo.
Step 1: Create MySQL Database and Tables
Step 2: Create a model file
Create a model file named “Site.php” inside “application/models” folder.
Step 3: Create a controller file
Next create a controller file named “Location.php” inside “application/controllers” folder.
Step 4: Change Route file
So open “application/config/routes.php” file and add code like as bellow:
Step 5: Create a view< file
Create a view file named “index.php” inside “application/views/emp” folder
Step 5: Create a file
Create a view file named “custom.js inside “assets/js” folder