Skip to content

Instantly share code, notes, and snippets.

@angelsystem
Created September 3, 2013 15:40
Show Gist options
  • Save angelsystem/6425584 to your computer and use it in GitHub Desktop.
Save angelsystem/6425584 to your computer and use it in GitHub Desktop.
Get tax.
#view
= select_tag "paisorigen", id: "country", "<option value=':PEN' >Perú</option> <option value=':COP'>Colombia</option><option value=':MXN'>Mexico</option><option value=':USD'>Otros</option>".html_safe, :include_blank => true, :class => "chosen required", :style => "padding: 8px 0px 0px 5px;width: 120px;margin: 18px 0px 4px 15px;", :required => "required "
#javascript
$(document).on 'change','select#country',(event) ->
target = $('#donde_se_va_mostrar')
country_code = $(@).val()
url = "/my_controller/my_method?country_code=#{country_code}"
target.load(url)
#controller my_controller
def my_method
@typechange = Tax.typechange(params[:country_code])
render partial: 'tax'
end
#view partial _taxt.html.haml
%label= @tyepchange
#routes
get :my_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment