你能帮我通过Ajax获取该表内按钮的数据吗?我试过了,但对我来说是不可能的。
我在很多方面尝试过使用Ajax,但它对我没用。我必须将按钮信息从一个页面带到另一个页面。
也就是说,我需要获取每个ID为btn-tiquetes
的按钮。感谢您的合作,谢谢。
$(function() {
$('.js-nav').on('click', function(e) {
e.preventDefault();
var $this = $(this);
var $url = $this.attr('href');
$.get($url, function(response) {
var $response = $("<div/>").html(response);
var $body = $response.find('#records').html();
var _isLight = $response.find('.table-responsive').hasClass('contenedor-tabla-registros');
console.log($body);
console.log(_isLight);
History.pushState({ state:$url }, $title, $url);
});
});
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="contenido" id="contenido">
<div class="container container-blue">
<header>
<h3>Get the info!</h3>
</header>
<div id="records">
<div class="table-responsive contenedor-tabla-registros">
<table class="tabla-registros table table-striped">
<thead>
<tr>
<th>departure date</th>
<th>Code</th>
<th>TypeTravel</th>
<th>Type Service</th>
<th>Class Vehicle</th>
<th>Vehículo</th>
<th>Path Code</th>
<th>Chairs Available</th>
<th>Status Travel</th>
<th>Status Term</th>
<th class="latest">actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<center>
03-02-2018 01:40 pm
<br>
<a href="#" id="btn-cambiar-fecha-viaje" data-id="45912" data-titulo="22152">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td>22152</td>
<td>Normal</td>
<td>General</td>
<td>ULTRA</td>
<td>1465</td>
<td title="PATH">RG14</td>
<td>
<center>0 / 19</center>
</td>
<td>
<center>
Active
<br>
<a href="#" id="btn-estados-viaje" data-id="45912" data-titulo="22152">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td>
<center>
Authorized
<br>
<a href="#" id="btn-estados" data-id="45912" data-titulo="22152">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td class="lista ultimo">
<ul class="acciones">
<li class="">
<button id="btn-detalle" class="btn btn-default btn-azul" data-id="45912" data-fecha="03-02-2018 01:40 pm">
Detail
</button>
</li>
<li class="ultimo">
<button id="btn-sillas-disponibles" class="btn btn-default btn-azul" data-id="45912">
Chairs Availables
</button>
</li>
</ul>
</td>
</tr>
<tr>
<td>
<center>
23-02-2018 08:22 am
<br>
<a href="#" id="btn-cambiar-fecha-viaje" data-id="46103" data-titulo="22258">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td>22258</td>
<td>Normal</td>
<td>Busta</td>
<td>RALE</td>
<td>550</td>
<td title="PATH">P01</td>
<td>
<center>27 / 27</center>
</td>
<td>
<center>
Active
<br>
<a href="#" id="btn-estados-viaje" data-id="46103" data-titulo="22258">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td>
<center>
Authorized
<br>
<a href="#" id="btn-estados" data-id="46103" data-titulo="22258">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td class="lista ultimo">
<ul class="acciones">
<li class="">
<button id="btn-tiquetes" class="btn btn-default btn-azul" data-id="46103" data-fecha="2018-02-23 08:22:00" data-titulo="PATH">
Tick
</button>
</li>
<li class="">
<button id="btn-detalle" class="btn btn-default btn-azul" data-id="46103" data-fecha="23-02-2018 08:22 am">
Detail
</button>
</li>
<li class="ultimo">
<button id="btn-sillas-disponibles" class="btn btn-default btn-azul" data-id="46103">
Chairs Availables
</button>
</li>
</ul>
</td>
</tr>
<tr>
<td>
<center>
23-02-2018 07:47 am
<br>
<a href="#" id="btn-cambiar-fecha-viaje" data-id="46123" data-titulo="22267">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td>22267</td>
<td>Normal</td>
<td>Genera Cerr</td>
<td>HINO</td>
<td>4056</td>
<td title="PATH">P14</td>
<td>
<center>35 / 35</center>
</td>
<td>
<center>
Active
<br>
<a href="#" id="btn-estados-viaje" data-id="46123" data-titulo="22267">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td>
<center>
Authorized
<br>
<a href="#" id="btn-estados" data-id="46123" data-titulo="22267">
<span class="ico editar" style="height: 8px;width: 5px;">
<b>Change</b>
</span>
</a>
</center>
</td>
<td>
<tr>
<ul class="acciones">
<li class="">
<button id="btn-tiquetes" class="btn btn-default btn-azul" data-id="46128" data-fecha="2018-02-24 08:29:00" data-titulo="PATH">
Tick
</button>
</li>
<li class="">
<button id="btn-detalle" class="btn btn-default btn-azul" data-id="46128" data-fecha="24-02-2018 08:29 am">
Detail
</button>
</li>
<li class="ultimo">
<button id="btn-sillas-disponibles" class="btn btn-default btn-azul" data-id="46128">
Chairs Availables
</button>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
&#13;