Suppose that you want to check name in userdata then make a page with name checksession.php with this code
<?php echo isset($_SESSION['some_name']); ?>
then in jquery put this code inside click handler
$( ".checkout-button" ).click(function() {
$.get( "checksession.php", function( data ) {
if(data==="TRUE")
{
alert('session exist');
}
else{
alert('session not exist');
}
});
}