Necesitas combiar un poco de paradigma de programacion, yo antes tambien tenia problemas con esa parte de javascript.
Te recomiendo el siguiente link que a mi me sirvio mucho, muchisimo para entender las "Promises" y como aplicarlas en mi codigo.
https://scotch.io/tutorials/javascript-promises-for-dummies
Espero que a ti tambien te funcione.
Saludos!
Te recomiendo el siguiente link que a mi me sirvio mucho, muchisimo para entender las "Promises" y como aplicarlas en mi codigo.
https://scotch.io/tutorials/javascript-promises-for-dummies
Espero que a ti tambien te funcione.
Saludos!
Recien lo termine de ver, te agradezco... igualmente no me queda todavía en claro como puedo aplicarlo...
Buscando por ahí encontré lo siguiente aunque tampoco me funciona, ¿será que estoy cerca de entender o cada vez estoy más lejos?
Código
$.when(Change_Select_Ubication('select_country')).then(function() { var select_province = document.getElementById('select_province'); var op_province = select_province.getElementsByTagName('option'); op_province[<?php echo($_POST['select_province']); ?>].selected = true; $.when(Change_Select_Ubication('select_province')).then(function() { var select_municipality = document.getElementById('select_municipality'); var op_municipality = select_municipality.getElementsByTagName('option'); op_municipality[<?php echo($_POST['select_municipality']); ?>].selected = true; $.when(Change_Select_Ubication('select_municipality')).then(function() { var select_city = document.getElementById('select_city'); var op_city = select_city.getElementsByTagName('option'); op_city[<?php echo($_POST['select_city']); ?>].selected = true; }); }); });