$ -> submit = -> host = $('#check_host').val() type = $('#check_type').val() window.location.href = "<%= Rails.configuration.relative_url_root %>/#{type}/#{host}" $('#check_host').keypress (e) -> submit() if e.which == 13 return $('#check_submit').click -> submit() return