<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,700">
<title>Unsubscribe</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<style>
body {
color: #fff;
background: #63738a;
font-family: 'Roboto', sans-serif;
}
.form-control {
height: 40px;
box-shadow: none;
color: #969fa4;
}
.form-control:focus {
border-color: #5cb85c;
}
.form-control, .btn {
border-radius: 3px;
}
.signup-form {
width: 550px;
margin: 0 auto;
padding: 200px 0;
font-size: 17px;
}
.signup-form h2 {
color: #636363;
margin: 0 0 15px;
position: relative;
text-align: center;
}
.signup-form h2:before, .signup-form h2:after {
content: "";
height: 2px;
width: 30%;
background: #d4d4d4;
position: absolute;
top: 50%;
z-index: 2;
}
.signup-form h2:before {
left: 0;
}
.signup-form h2:after {
right: 0;
}
.signup-form .hint-text {
color: #999;
margin-bottom: 30px;
text-align: center;
}
.signup-form form {
color: #999;
border-radius: 3px;
margin-bottom: 15px;
background: white;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
padding: 30px;
}
.signup-form .form-group {
margin-bottom: 20px;
}
.signup-form input[type="checkbox"] {
margin-top: 3px;
}
.signup-form .btn {
font-size: 16px;
font-weight: bold;
min-width: 140px;
outline: none !important;
}
.signup-form .row div:first-child {
padding-right: 10px;
}
.signup-form .row div:last-child {
padding-left: 10px;
}
.signup-form a {
color: #fff;
text-decoration: underline;
}
.signup-form a:hover {
text-decoration: none;
}
.signup-form form a {
color: #5cb85c;
text-decoration: none;
}
.signup-form form a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="signup-form">
<form action="" method="post">
<h2>Unsubscribe</h2>
<div id="mainform">
<p class="hint-text">If you have a moment, please let us know why you unsubscribed:</p>
<div class="radio">
<label><input type="radio" name="optradio" class="optradio" checked value="I no longer want to receive these emails"> I no longer want to receive these emails</label>
</div>
<div class="radio">
<label><input type="radio" name="optradio" class="optradio" value="The emails are inappropriate"> The emails are inappropriate</label>
</div>
<div class="radio disabled">
<label><input type="radio" name="optradio" class="optradio" value="he emails are spam and should be reported"> he emails are spam and should be reported</label>
</div>
<div class="radio disabled">
<label><input type="radio" name="optradio" value="others" id="others" class="optradio"> Other (fill in reason below)</label>
</div>
<br>
<div class="form-group" id="reason" style="display:none;">
<label for="comment">Reason:</label>
<textarea class="form-control" rows="5" id="comment"></textarea>
</div>
<div class="form-group">
<button type="button" class="btn btn-success btn-lg btn-block" id="unsubscribe">Unsubscribe Now</button>
</div>
</div>
<div id="success" style="display:none;">
<p style="color:green;" align="center">Unsubscribe successful !</p>
</div>
</form>
<script>
$(document).ready(function(){
$(".optradio").click(function(){
if($("#others").prop("checked") == true && $("#others").val()=='others'){
$("#reason").show();
}
else{
$("#reason").hide();
}
});
});
$("#unsubscribe").on('click',function(){
var reason = $("#comment").val();
var option = $("input:radio[name='optradio']:checked").val();
var user_id=<?php echo $_GET['user_id'];?>;
$.ajax({
url: "<?php echo base_url()?>unsubscribe/process",
type: "POST",
data: {
"reason":reason,
"option":option,
"user_id": user_id
},
cache: false,
success: function(dataResult){
var dataResult = JSON.parse(dataResult);
if(dataResult.statusCode==200){
$("#mainform").hide();
$("#success").show();
}
}
});
});
</script>
</div>
</body>
</html>