Last active
September 9, 2016 19:27
-
-
Save jschwindt/cefcc3705bc28cddb78b2588ab9f40cb to your computer and use it in GitHub Desktop.
Actualización de combo de modelos cuando cambia la marca
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery ($) -> | |
$('#car_brand_id').change -> | |
$.getJSON "/brands/#{ $(this).val() }/models.json", (data) -> | |
items = [ '<option value=""> </option>' ] | |
$.each data, (key, val) -> | |
items.push("<option value='#{ val.id }'>#{val.name}</option>") | |
$('#car_model_id').html(items.join('')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment