state_select.js.coffee 305 Bytes
Newer Older
1
@state_select = (event) ->
2 3 4 5 6 7 8 9 10 11
  $.get(
    '/states',
    {
      country: $('select#profile_country :selected').text(),
      locale: $('#locale').val()
    },
    (data) ->
      $('div#state_select').html(data)
  )

12 13
$(document).ready(@state_select)
$('select#profile_country').on('change', @state_select)