PHP の場合:
$('.checkbox').on('change', function(){
if($(this).is(':checked')){
var doNotShow = TRUE;
//the chekbox has been checked, the user does not want to see this again.
$.ajax({
url: 'path/to/my/controller.ext',
data: 'doNotShow='+doNotShow,
success: function(data){
//the data has been sent to the server, close the popup box, do whatever is necessary here.
// change the window location, whatever.
}
});
}
});
サーバー側の PHP コード (path/to/my/controller.ext) --
if(isset($_POST['doNotShow']) && $_POST['doNotShow'] == TRUE):
$_SESSION['doNotShow'] = $_POST['doNotShow'];
endif;
ダイアログ ボックスをロードする前に、それを条件付けする PHP を追加する必要があります。
<?php
if(!isset($_SESSION['doNotShow'])):
?>
//javascript to launch the popup, the session is not set.
<?php
elseif(isset($_SESSION['doNotShow']) && ($_SESSION['doNotShow'] == TRUE)):
?>
//don't launch the popup, they don't want to see it, whatever..
<?php
endif;