JQuery ajax call issue
Posted: 2025-04-22 04:11
I added a button in the header-extra.php file:
i added this code to the footer-extra.php file:
Code in test.php:
test.php is in the /garc/hooks/rpts/ folder
When I click the "Print Reservations" button the alert(curentMemberID) fires but the app never goes to test.php. Any ideas why it doesn't?
Any help with this is greatly appreciated
TD
Code: Select all
<button class="btn btn-primary" onclick="dlg()">Print Reservations</button>
Code: Select all
<script>
function dlg(){
var currentMemberID = '<?=getLoggedMemberID()?>';
if (currentMemberID != 'guest'){
alert(currentMemberID); //here just to see if function is working
$j.ajax({
type: "POST",
url: "../../test.php",
data: "cs="+currentMemberID,
datatype: "text"
});
}
}
</script>
Code: Select all
<?php
$callsign = $_POST['cs'];
echo '<script>alert('.$callsign.')</script>';
echo $callsign;
echo 'test'; //just to see if it works at all
?>
When I click the "Print Reservations" button the alert(curentMemberID) fires but the app never goes to test.php. Any ideas why it doesn't?
Any help with this is greatly appreciated
TD