Populating city Dropdown based on Country Selecting by using jQuery and Ajax. Step 1: Load the jquery library <script type="text/javascript" src="http://code.jquery.com/jquery.js"></script> Html view: <div> <label>Country:</label> <select class="country"> <option>Select</option> <option value="usa">United States</option> <option value="india">India</option> <option value="uk">United Kingdom</option> </select> </div> <div id="response"> <!--Response will be inserted here--> </div> Step 2: Call jQuery change event and fetch the ajax <script type="text/javascript"> $(document).ready(function(){ $("select.country").change(function(){ var selectedCountry = $(".country option:selected").val(); $.ajax({ ...
Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.