I use jquery to upload part of the code in PHP on changing or uploading data
it works fine in the first click but if I try to do it again not working
I use the same code for the first dropdown and it work so I did the same for the second one
the first one working fine and I can do change as many times
but the second one first click work if I try again nothing happen I need to refresh the page to make it work
There isn’t anything on the console
so I think I did something wrong with jquery
HTML
<ul class="nav nav-tabs nav-tabs-solid nav-tabs-rounded d-lg-flex justify-content-center">
<li class="nav-item dropdown p-1">
<a class="nav-link dropdown-toggle active" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Status </a>
<div class="dropdown-menu">
<a class="dropdown-item active" id="all" data-toggle="tab">all</a>
<a class="dropdown-item " id="new" data-toggle="tab">New</a>
<a class="dropdown-item" id="connected" data-toggle="tab">Connected</a>
<a class="dropdown-item" id="canceled" data-toggle="tab">canceled</a>
</div>
</li>
<li class="nav-item p-1 ">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<!-- <span class="sr-only">Toggle Dropdown</span> -->
Edit
</button>
<div class="dropdown-menu">
<a class="dropdown-item" id="toconnected">Connected</a>
<a class="dropdown-item" id="tocanceled">canceled</a>
</div>
</div>
</li>
</ul>
<table class="table table-hover table-center text-center mb-0 resp-table schedule">
<thead>
<tr>
<th class=""> </th>
.
.
.
<th></th>
</tr>
</thead>
<tbody id="serviceTable">
<?php foreach ($call as $i) { ?>
<tr>
<td>
<input type="checkbox" class="checkbox" value="<?php echo $i['Order_id']; ?>" name="Order_id" id="<?php echo $i['Order_id']; ?>">
</td>
.
.
</tr>
<?php } ?>
</tbody>
</table>
jqury
$(function(){
//view base on status of the order
$('a[id=new]').on('click', function(){
$("#serviceTable").load("..//..//forms//load-schedule-communication.php"//)
, {
filter: "new"
});
})
//for the edit
$('a[id=toconnected]').on('click', function(){
var orderids =document.querySelectorAll('.checkbox');
for (var orderid of orderids) {
if(orderid.checked){
var filterstatus='';
var statusOrders = document.getElementsByClassName("dropdown-item active");
for (var statusOrder of statusOrders) {
if(statusOrder.id=='new'){
filterstatus='new';
}
else if (statusOrder.id=='connected'){
filterstatus='connected';
}
else if(statusOrder.id=='pending'){
filterstatus='pending';
}
else if(statusOrder.id=='no_response'){
filterstatus='no_response';
}
else if(statusOrder.id=='all'){
filterstatus='all';
}
else if(statusOrder.id=='delete'){
filterstatus='delete';
}
}
$("#serviceTable").load("..//..//forms//load-schedule-communication.php"//)
, {
statusto: "connected",
id: orderid.id,
statusorder: filterstatus
});
}
}
})
})