Sto usando la tabella bootstrap. In questo voglio ottenere il valore/i valori Item ID
delle righe della tabella selezionate dopo aver fatto clic sul pulsante 'Add to cart'
presente sulla stessa pagina.Ottenere i valori delle righe della tabella selezionata in bootstrap usando jquery
codice Tabella:
<table data-toggle="table" id="table-style" data-row-style="rowStyle" data-url="tables/data2.json" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-search="true" data-select-item-name="toolbar1" data-pagination="true" data-sort-name="name" data-sort-order="desc" data-single-select="false" data-click-to-select="true" data-maintain-selected="true">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id" >Item ID</th>
<th data-field="name" data-sortable="true">Product Name</th>
<th data-field="price" data-sortable="true">Actual Price</th>
<th data-field="discount_price" data-sortable="true">Discount Price</th>
<th data-field="stock_avail" data-sortable="true">Stock Available</th>
</tr>
</thead>
</table>
codice jQuery:
$(document).ready(function()
{
$("#add_cart").click(function()
{
//foreach selected row retrieve 'Item ID' values in array;
//call ajax for otherpage.php?arr='Item ID array';
});
});
Come io sono nuovo in bootstrap che sto cercando di affrontare questo, ma non ricevendo adeguata soluzione favore qualcuno me questo avvisare.
Come i tr td' dati 'assomigliano? –
@ NorlihazmeyGhazali- per favore vedi la mia domanda modificata. –
Opss scusate, ancora una volta, sei sicuro della struttura HTML delle righe della tabella, vuoi vedere come l'HTML è stato reso. Solo poche righe –