无法通过JQuery将PHP变量传递给模态弹出窗口

Have a singe page, payments.php shown below. This page initially contains a table populated from a SQL query. When the name on the table is clicked it should carry through the variable for the payment ID which is used in a SQL query to populate the details for that payment.

The ID for the payment is passed from php to JQuery via the data-pid variable in the URL, this is then converted to a JQuery variable pmntid. At this stage all is working well and the correct pmntid is shown in the console in Firebug as shown below.

enter image description here

At this point using AJAX POST to convert the pmntid variable to idNumber and show the popup. the popup has an echo to show the number. When the popup is displayed there is no value in the echo for idnumber and no data, viewing Post in Firebug shows idNumber equals the correct number. performing a print_r($_POST) gives a result of Array().

Have searched for an answer to this however have been unable to get it working, the code in it's entirety is shown below:

payments.php

<?php
session_start();

$pageTitle = "Payments";
require 'dbconnect.php';
include 'header.php';

//Entered Payments
$paymentProcEntered = "SELECT * FROM test";
$paymentProcQuery = $connection->query($paymentProcEntered);

mysqli_close();

?>

<!DOCTYPE html>
<html>
    <head>
    </head>
   <body>
<div id="main">

    <div id="mainContainer">

<p class="sectionTitle">Click On Name To View Details.</p>
<?php
    echo "<table class='pmntTable'>
    <tr class='pmntRowBgd'>
        <td>
    <div id='pmntContainer'>
    <div class='pmntMainTitlelft'>Payments</div>
    <div class='pmntMainTitlergt'>Total: ".$paymentProcQuery->num_rows."</div>
            <div id='pmntListingContainer'>
    <table class='sortable'>
    <thead>
    <tr>
        <th class='sorttable_alpha'>Holder</th>
        <th>Amount</th>
        <th>Names</th>
        <th>Date Received</th>
        <th>Date Entered&nbsp</th>
        <th class='sorttable_nosort'>Entered By</th>
    </tr>
    </thead>";

    while($row = mysqli_fetch_array($paymentProcQuery))
        {
        $dateReceived = date_create($row[6]);
        $dateEntered = date_create($row[7]);
        echo "<tr>";
?>

    <td class="listingTextLeft">
    <a href="?pid=<?php echo $row[0] ?>" data-pid="<?php echo $row[0] ?>" class="pmntDetail">
    <?php echo $row[20] ?></a></td>
<?php
echo "<td class='listingTextRight'> $".number_format($row[4],2)."</td>
<td class='listingTextCentre'>".number_format($row[5])."</td>
<td class='listingTextCentre'>".date_format($dateReceived,"d-M-Y")."</td>
<td class='listingTextCentre'>".date_format($dateEntered,"d-M-Y")."</td>
<td class='listingTextCentre'>".$row[8]."</td>
</tr>";
    }
    echo "</table>
        </div>
        </div>
    </td>
    </tr>
</table>
</div>";    
?>

<div id="pmntDetailPopup" class="pmnt_content">

<?php 

include 'dbconnect.php';

$idNumber = $_POST['idNumber'];
echo "ID: ".$idNumber;

$paymentDetailEntered = "SELECT * FROM test WHERE paymentid = '$idNumber'";
$paymentDetailQuery = $connection->query($paymentDetailEntered);

mysqli_close();

while($row = mysqli_fetch_array($paymentDetailQuery))
    {
    $dateReceived = date_create($row[6]);
    $dateEntered = date_create($row[7]);
    $dateCABEnter = date_create($row[10]);
    $dateCABCheck = date_create($row[13]);
    $dateDetailCheck = date_create($row[17]); 
echo "<div class='sectionTitle'>Payment Details</div>
    <div id='pmntPopupContainer'>
    <div class='sectionSubtitleLeft pmntSubTitlelft'>Initial Entry</div>
    <ul class='pmntDetailList'>
    <li><label>Holder</label><span>".$row[20]."</span></li>
    <li><label>Amount</label><span> $".number_format($row[4],2)."</span>
    <li><label>Number Of Names</label><span>".number_format($row[5])."</span></li>
    <li><label>Date Received</label><span>".date_format($dateReceived,"d-M-Y")."</span></li>
    <li><label>Date Entered In Database</label><span>".date_format($dateEntered,"d-M-Y")."</span></li>
    <li><label>Entered By</label><span>".$row[8]."</span></li>
    </ul>
    </div>
    </div>
</div>";
                }
?>

<script>
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%"]});    
                }
        });
    });
});
</script>
  </body>
</html>

I have tested the popup with a static value for idNumber and it works as it should, the error is just in passing the variable to the query to populate the popup.

Any help would be appreciated, I hope I've explained things well enough.