I want to pass double id (data-id1 and data-id2) values in modal. when i try to do so i get only on data-id1 being pass the data-id2 doesn't get pass, so the Modal popups with an empty table.
this is my view before triggering the modal
this is my HTML query:
<a class="openModal" data-id1="<?php echo htmlentities($result->requestitem_item); ?>" data-id2="<?php echo htmlentities($result->request_NUMBER); ?>" data-toggle="modal" href="#myModal"><input style="font-size:25px" type="text" name="itemserialno[]" value="" required>
and this is my script:
<script>
$('.openModal').click(function(){
var id1 = $(this).attr('data-id1');
var id2 = $(this).attr('data-id2');
$.ajax({url:"modalajax.php?id1=&id2="+(id1&id2),cache:false,success:function(result){
$(".modal-content").html(result);
}});
});
</script>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog" style="width:50%">
<div class="modal-content">
</div>
</div>
</div>
Below is my Modal $_GET trigger:
$ID=$_GET['id1']??'';
$ID1=$_GET['id2']??'';
$sql = "SELECT * from itemTABLE where (itemTABLE_item ='$ID1' and itemTABLE_requestNUMBER ='$ID2') and itemTABLE_acceptance != 'Reject' " ;
It should be like this
$.ajax({
url: "modalajax.php?id1=" + id1 + "&id2=" + id2,
cache: false,
success: function(result) {
$(".modal-content").html(result);
}
});