何时删除通过ajax调用如何从视图中删除该内容。如何删除通知计数并删除父母删除时
这是我的阿贾克斯调用,我删除了一个工作,当它删除。
- 是家长要删除和
- 工作的通知计数已刷新(我的作业(3)它应该为2,因为只有2个工作现在已经有以dB为单位,当我退出更改和登录它未来为2)
这里是我的ajax控制器代码:
elseif(isset($_POST['res'])&& ($_POST['res'] =='no'))
{
$jobId=$_POST['jobId'];
$updateStatus=$conn->query("UPDATE r_job_invitations SET inv_res='2' WHERE id_job='".$jobId."' ");
if ($updateStatus) {
$response['message'] = "<strong>Success!</strong> Job Rejected.";
$response['success'] = true;
} else {
$response['message'] = "<strong>Warning!</strong> There is an error in Job Rejection please try again";
$response['success'] = false;
}
echo json_encode($response);
exit;
}
我的Ajax调用发送请求:
<a href="javascript:;" class="btn btn-default" onclick="jobResponse('no',<?php echo $myjobs['id_job'];?>)">Reject And Delete</a>
<script type="text/javascript">
function jobResponse(res,jobId){
var frm_data = { res : res,
jobId : jobId
}
$.ajax({
method: "POST",
url: 'inv-controller.php',
data: frm_data,
dataType: "json",
success: function (response) {
if (response["success"] == true)
{
$("#success-message").show();
$("#success-message").html(response["message"]);
} else {
$("#warning-message").show();
$("#warning-message").html(response["message"]);
}
},
error: function (request, status, error) {
$("#warning-message").show();
$("#warning-message").html("OOPS! Something Went Wrong Please Try After Sometime!");
}
});
}
</script>
最后这个职位数会话从登录控制器
到来,而在我登录我stroing,乔布斯在一个会话数是这样的:
$Query = $conn->query("SELECT count(*) as notificationCount FROM r_job_invitations where email='".$_SESSION['user_email']."' and inv_res=0") or die(mysqli_error());
$notification = mysqli_fetch_assoc($Query);
$_SESSION['notificationCount'] = $notification['notificationCount'];
echo BASE_URL."my-profile.php";
我想更新此会话数。我怎样才能做到这一点。?