当ajax返回true时,我想更改表行状态(是或否)。我的ajax请求工作正常但已更改了表所有行状态。
这是我的观点
OBJECT_NAME, OBJECT_TYPE, STATUS
----------------------------------
MSGHEADERTYPE, TYPE, VALID
MSGHEADERTYPE, SYNONYM, VALID
PAYLOADLISTTYPE, TYPE, VALID
@endforeach
这是我的ajax代码
@foreach($order_details as $key => $list)
<tr>
<td>{{$list->order_product_name}}</td>
<td>{{ $size }}</td>
<td>{{ $color }}</td>
<td>{{$list->order_product_quantity}}</td>
<td>{{ $list->tax_rate_percentage }}</td>
<td>{{ $list->tax_amount }}</td>
<td>{{ $list->order_product_unit_price }}</td>
<td>{{ $list->order_product_total_price }}</td>
<td><input type="text" data-order-id="{{ $list->order_id }}" class="product-check-physical" name="product_id">
</td>
<td>
<span class="done label label-success">Yes</span>
<span class="not-done label label-danger">No</span>
</td>
这是我的控制器
var site_url = $('.site_url').val();
$('.done').hide();
$('.not-done').show();
$('.product-check-physical').on('keyup', function () {
var order_id = $(this).data('order-id')
var product_id = $('.product-check-physical').val();
$.ajax({
url : site_url + '/order/details/product/issue/delivery/man/' + order_id + '/' + product_id,
type : 'GET',
dataType : 'json',
success : function(data) {
if(data.status == 0) {
sweetAlert('Sorry....','This product not found','error');
return;
}
//alert(data.status.order_product_name )
$('.done').show().closest('tr');
$('.not-done').hide().closest('tr');
},
error : function() {
console.log('error');
}
});
});