user7598085
user7598085

Reputation:

link_to, use data for popup, without confirm options

Can it be done without confirm dialog/confirm options - just regular info window.

I'am trying with this...

<%= link_to "Info", customer, remote:true, data: 
{confirm: "Customer Info: #{customer.first_name}"} %>

This shows me choose options, I just want OK button.

I have datatable with a lot of columns. In one column (Customer ID), I have info button. On that click, i just wan to show additional data. No network call, I have all data in datatable array. Just wan to call it with link to using data, but without confirm options (Cancel/Ok), just regular Ok button. Without making other custom dialog and sending data there. Thanks.

Upvotes: 0

Views: 90

Answers (1)

Anand
Anand

Reputation: 6531

<tr id="customer_<%= customer.id %>">
  <td><%= customer.first_name %></td>
  <td><%= customer.last_name %></td>
  <td> <%= link_to 'Delete','', :class => 'btn btn-sm btn-danger', :onclick => 'show_info('<%=customer.first_name%>', '<%=customer.last_name%>');' %></td>
</tr>

<script type="text/javascript">
  function show_info(first_name, last_name){
    var text = first_name + ' ' + last_name
    alert(text);
  }
</script>

Upvotes: 1

Related Questions