title: Enable button on Ajax response in foreach loop
body: <p>I want to enable/disable multiple buttons rendered in @foreach loop when Ajax return 1.
  This script work but enable only 1 button of the loop</p>
  
  <pre><code>    $('#verifica').click(function(){ 
    var verifica_indirizzo = document.getElementById("verifica_indirizzo").value; 
    var servizio = &lt;?php echo json_encode($servizio); ?&gt;;
      $.ajax({
        url: 'verifica?id_servizio=' + servizio +'&amp;verifica_indirizzo=' + verifica_indirizzo,
        type: "get",
        success: function(data){
            if ( data.CAP == 1 ) {
                $('#blocco_verifica').html(''); // reset the current content.
                $('#blocco_verifica').html('&lt;div id="blocco_verifica" class="alert alert-success fade in block-inner" style="height:100px;"&gt;\
              &lt;i class="fa fa-map"&gt;&lt;/i&gt;&lt;h4&gt;Complimenti!&lt;/h4&gt;&lt;p&gt;Il servizio è abilitato nella tua zona&lt;/p&gt;\
              &lt;/div&gt;');
                $('#abilita').prop('disabled', false);
              } else {
                $('#blocco_verifica').html(''); // reset the current content.
                $('#blocco_verifica').html('&lt;div id="blocco_verifica" class="alert alert-danger fade in block-inner" style="height:100px;"&gt;\
              &lt;i class="fa fa-map"&gt;&lt;/i&gt;&lt;h4&gt;Resta aggiornato!&lt;/h4&gt;&lt;p&gt;Purtroppo il servizio non è ancora abilitato nella tua zona.&lt;/p&gt;\
              &lt;/div&gt;');
                $('#abilita').prop('disabled', true);
  
  
              }
  
        }
      });      
    }); 
  </code></pre>
  
  <p>Here is the loop. I want that when from AJAX got 1 as response, the buttons #abilita is enabled else remain disabled</p>
  
  <pre><code>@foreach($tariffe as $tariffa)
                    &lt;tr&gt;
                      &lt;td&gt;
                  &lt;a href="#" data-toggle="tooltip" title="{{ $tariffa-&gt;tooltip }}"&gt;{{ $tariffa-&gt;nome_servizio }}&lt;/a&gt;&lt;/td&gt;
                  &lt;?php $tipo = Db::table('tipologia_tariffa')-&gt;where('id', $tariffa-&gt;id_tipologia_tariffa)-&gt;first(); ?&gt;
                      &lt;?php $prezzo_frm = money_format('%.1n', $tariffa-&gt;prezzo); ?&gt;
                      &lt;td&gt;{{ $prezzo_frm }}&amp;nbsp; / {{ $tipo-&gt;nome }}&lt;/td&gt;
                      @if(!empty($coupon))
                      &lt;?php $prezzo_frms = money_format('%.1n', $tariffa-&gt;prezzo_scontato); ?&gt;
                      &lt;td&gt;{{ $prezzo_frms }} &amp;nbsp;/ {{ $tipo-&gt;nome }}&lt;/td&gt;
                      @endif
                      &lt;td&gt;
                      @if($tariffa-&gt;numero_verde == 0 &amp;&amp; $tariffa-&gt;geo == 0)
                      &lt;button id="abilita" @if(!empty($dettaglio-&gt;id_zone)) disabled @endif type="button"  class="btn btn-info" data-toggle="modal" data-tariffa="{{ $tariffa-&gt;id }}" data-target="#normale"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt;&amp;nbsp;Prenota&lt;/button&gt;
                      @elseif($tariffa-&gt;geo == 1 &amp;&amp; $tariffa-&gt;numero_verde == 0)
                       &lt;button id="abilita" @if(!empty($dettaglio-&gt;id_zone)) disabled @endif type="button" class="btn btn-info" data-toggle="modal" data-tariffa="{{ $tariffa-&gt;id }}" data-target="#geo"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt;&amp;nbsp;Prenota&lt;/button&gt;
                      @else
                       &lt;button id="abilita" @if(!empty($dettaglio-&gt;id_zone)) disabled @endif id="prenota" type="button" class="btn btn-info" data-toggle="modal" data-tariffa="{{ $tariffa-&gt;id }}" data-target="#NumeroVerde"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt;&amp;nbsp;Prenota&lt;/button&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt; 
                    @endif
                   @endforeach
  </code></pre>