D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
buildteksolution
/
www
/
superadmin
/
Filename :
filter.php
back
Copy
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> </head> <body> <div class="container"> <div class="row" style="margin-top:15px;"> <div class="col-md-4"> <select class="form-select" id="country"> <option value="">Country</Option> </select> </div> <div class="col-md-4"> <select class="form-select" id="state"> <option value="">State</Option> </select> </div> <div class="col-md-4"> <select class="form-select" id="city"> <option value="">City</Option> </select> </div> </div> </div> </body> <script type="text/javascript"> let auth_token; $(document).ready(function(){ $.ajax({ type: 'get', url:'https://www.universal-tutorial.com/api/getaccesstoken', success:function(data) { auth_token = data.auth_token; getcontry(data.auth_token); }, error:function(error) { console.log(error); }, headers: { "Accept": "application/json", "api-token": "kCx_1pg9DAixSRJ21SIyJ9NgMAKdjOQmbGT_0fMTNqhP1jNUFBP9PQSFz4UNXciJS4M", "user-email": "adarshjack007@gmail.com" } }); $('#country').change(function(){ getstate(); }); $('#state').change(function(){ getcity(); }); }); function getcontry(auth_token){ $.ajax({ type: 'get', url:'https://www.universal-tutorial.com/api/countries/', success:function(data) { data.forEach(element=>{ $('#country').append('<option value="'+element.country_name+'">'+element.country_name+'</option>'); }); // getstate(auth_token); }, error:function(error) { console.log(error); }, headers: { "Authorization": "Bearer "+ auth_token, "Accept": "application/json" } }); } function getstate(){ let country_name= $('#country').val(); $.ajax({ type: 'get', url:'https://www.universal-tutorial.com/api/states/'+country_name , success:function(data) { $('#state').empty(); data.forEach(element=>{ $('#state').append('<option value="'+element.state_name+'">'+element.state_name+'</option>'); }); }, error:function(error) { console.log(error); }, headers: { "Authorization": "Bearer "+ auth_token, "Accept": "application/json" } }) ; } function getcity(){ let state_name=$('#state').val(); $.ajax({ type: 'get', url:'https://www.universal-tutorial.com/api/cities/'+state_name , success:function(data) { $('#city').empty(); data.forEach(element=>{ $('#city').append('<option value="'+element.city_name+'">'+element.city_name+'</option>'); }); // getcountry(data.auth_token); }, error:function(error) { console.log(error); }, headers: { "Authorization": "Bearer "+ auth_token, "Accept": "application/json" } }) ; } </script> </html>