1 回答
TA贡献1788条经验 获得超4个赞
检查一下,您的代码有几个问题。希望这会有所帮助。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<div style="margin-top: 40px;">
<table style="border-collapse:collapse;">
<thead>
<th>Id</th>
<th>Catalogue ID</th>
<th>Product Name</th>
<th>Catagory</th>
<th>Account</th>
</thead>
<tbody>
<tr class="variation_load_tr" style="cursor: pointer;" data-toggle="collapse" onclick="getVariation(this,0)" data-target="#demo1" class="accordion-toggle">
<td>
<div id="product_variation_loading0" class="variation_load" style="display: none;">
<div class="spin_loading">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
</div>
15424181
</td>
<td>13463</td>
<td>DIESEL BLACK GOLD JIPLAID Mens Parka</td>
<td>Clothing, Shoes & Accessories>Men>Men's</td>
<td>Topbrand</td>
</tr>
<!--hidden row -->
<tr>
<td colspan="13" class="hiddenRow" style="padding: 0; background-color: #ccc">
<div class="accordian-body collapse" id="demo1">
<table>
<thead>
<tr>
<th>SKU</th>
<th>start Price</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>B7-1306</td>
<td>20.99</td>
<td>3</td>
</tr>
<tr>
<td>B7-1307</td>
<td>20.99</td>
<td>5</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<!--end hidden row -->
<tr data-toggle="collapse" style="cursor: pointer;" onclick="getVariation(this,1)" data-target="#demo2" class="accordion-toggle">
<td>
<div id="product_variation_loading1" class="variation_load" style="display: none;">
<div class="spin_loading">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
</div>
15424182
</td>
<td>13464</td>
<td>DIESEL BLACK GOLD JIPLAID Mens </td>
<td>Clothing, Shoes & Accessories>Men>Men's</td>
<td>Topbrand</td>
</tr>
<!--hidden row -->
<tr>
<td colspan="13" class="hiddenRow" style="padding: 0; background-color: #ccc">
<div class="accordian-body collapse" id="demo2">
<table>
<thead>
<tr>
<th>SKU</th>
<th>start Price</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>B7-1308</td>
<td>129.99</td>
<td>1</td>
</tr>
<tr>
<td>B7-1309</td>
<td>129.99</td>
<td>2</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<!--end hidden row -->
</tbody>
</table>
</div>
$('.accordian-body').on('show.bs.collapse', function () {
$(this).closest("table")
.find(".collapse.in")
.not(this)
.collapse('toggle')
})
function getVariation(obj,id){
$('.variation_load').hide();
$.ajax({
type: "post",
url: "{{url('get-ebay-variation')}}",
data: {
"_token" : "{{csrf_token()}}",
},
beforeSend: function () {
$('#product_variation_loading'+id).show();
},
complete: function () {
$('#product_variation_loading'+id).hide();
}
})
}
https://jsfiddle.net/9ej32fpw/2/
添加回答
举报