Have a link that passes the pid value through a URL to go to JQuery, the link is shown below:
<td class="listingTextLeft">
<a href="?pmntid=<?php echo $row[0] ?>" data-pid="<?php echo $row[0] ?>" class="pmntDetail"><?php echo $row[20] ?>
</a></td>
this passes the pid through to the JQuery below:
jQuery('.pmntDetail').each(function(i,v){
jQuery(v).click(function(paymentID){
paymentID.preventDefault();
paymentID.stopPropagation();
var pmntid = $(this).data("pid");
console.log("ID: ", pmntid);
$.ajax({
type: 'post',
url: 'payments.php',
data: { idNumber: pmntid },
success: function(data) {
$("#pmntDetailPopup").modal({position: ["5%"]});
}
});
});
});
The console log shows the correct value for the pid and idNumber is shown in Post in Firebug correctly, however I am unable to pass it through to a popup div on the same page to be used in another query, echo $_POST['idNumber'] gives a blank.
Have read other answers on here and other sites but have been unable to get them to work.
What I would like to do is pass the pid variable to the SQL query that is used to populate the jquery modal popup box.
**EDIT ** Have updated the JQuery code with the ajax added, is sitll not passing the variable through.
Aucun commentaire:
Enregistrer un commentaire