[英]jQuery $.get or $.post doesn't seem to work
Hi everyone I have two PHP session variables which onclick I want to scrub the values of the two session values. 大家好,我有两个PHP会话变量,它们要onclick我要清理两个会话值的值。
I have tried using $.get and $.post AJAX to get a external php page to run to clear down the session variables but it doesn't seem to work and I am not sure how I can debug it. 我尝试使用$ .get和$ .post AJAX来运行外部php页面以清除会话变量,但是它似乎无法正常工作,我不确定如何调试它。
In the page that handles the click: 在处理点击的页面中:
$('.ResetButton').click(function(){
$('.tablesorter').trigger('sortReset');
$.get("scripts/clear_sort.php", {ClaimSort:0}, function(data){});
return false;
});
and clear_sort.php file contains: 和clear_sort.php文件包含:
<?php
require ("scripts/session_handle.php");
$_SESSION['ClaimSort'] = '';
$_SESSION['ClaimSort2'] = '';
?>
ideas? 想法?
there was no php errors as there was nothing wrong with the code. 没有php错误,因为代码没有错误。 The JS was firing and was working OK. JS正在射击,并且工作正常。
Turns out I was an idiot when I was being lazy and copied the include and forgot to remove scripts/ so it was actually working all OK it just didn't initiate the session before trying to scrub the variables. 原来,当我懒惰并复制include并忘记删除脚本/时,我是个白痴,因此它实际上可以正常工作,只是在尝试清理变量之前没有启动会话。
School boy! 男生! Thanks for the help. 谢谢您的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.