I have the following input box in PHP while loop:
echo '<ul>';
while ( $data = $supplier->result->fetch_assoc()) {
$sid = (int) $data['sid'];
$supplierName = output($data['supplierName']);
$vid = output($data['vid']);
echo "
<li>
<input type='checkbox' name='sid[]' data-sid='$sid' value='{$sid}|$vid' class='supplierClass'> $supplierName
<div class='allVehicle'></div>
</li>
";
}
echo '</ul>';
Now when I click on a checkbox it's calling another PHP page using jQuery/Ajax, but the result is not showing.
jQuery/Ajax Code:
$('.supplierClass').change(function() {
var sids = [];
$('.supplierClass:checked').each(function(i,v) {
sids.push($(v).val());
});
$.ajax({
url : 'process/get-vehicle.php',
type : 'POST',
dataType : 'html',
data : {
sid : sids,
},
beforeSend : function () {
$(this).next('.allVehicle').html('Please wait...');
},
success : function ( result ) {
$(this).next('.allVehicle').html(result);
}
});
});
I think the problem is on this line but not sure.
beforeSend : function () {
$(this).next('.allVehicle').html('Please wait...');
},
success : function ( result ) {
$(this).next('.allVehicle').html(result);
}