How can I use the link_to
helper to make a link without an href
attribute? I want to make a link exclusively for a javascript action, I don\'t want
<%= link_to '+ Add Make', 'javascript:void(0)', id: 'add-make', onclick: 'addMake()' %>
and then your jQuery:
function addMake() {
$.ajax({
url: '/dealers',
type: 'GET',
dataType: 'script',
success: function (data) {
console.log('it was successful')
$('.add-make').hide();
},
error: function (data) {
console.log('it was error')
}
});
}