Skip to main content

Disable Button from a link by ajax

example -1
<% if @contest.extension_status == 'pending' %>
  <li><%= link_to 'Extend Contest', admin_extend_contest_path(id: @contest.id), {:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window', title: "Extend Contest",id: "extend_contest_link"} %></li>
<% elsif @contest.extension_status == 'complete' %>
  <li><%= link_to 'Alredy Extended', '#',title: "Alredy Extended", class: 'disabled' %></li>

<% else %>

<script>

$('#refund_contest a').addClass('disabled');
$('#refund_contest a').text('Refunded');
$('#refund_contest a').attr('href', '#');

$('.status').text('closed');

</script>

Comments

Popular posts from this blog

Undefined method `stringify_keys' for " ": String

<%= link_to 'NAME_OF_LINK ', URL_OF_LINK_path, class: "XXX", remote: true do %>      #here comes wrapping code  <% end %> This gives error of  Undefined method `stringify_keys'  for " ": String,  Reason being :-   its not good practice to write NAME_OF_LINK,  with link_to .. do   block Typically this is used when you want to have images or other tags as the contents of the link. It's purely for display purposes  here i have given few examples for ............