Skip to main content

Posts

Showing posts with the label jquery City Country dropdown

jQuery Populate City Country Dropdown in Cakephp

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({          ...