Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IE9 PHP和会话通过ajax在卸载时销毁-在刷新页面上激发_Php_Ajax_Session_Internet Explorer 9 - Fatal编程技术网

IE9 PHP和会话通过ajax在卸载时销毁-在刷新页面上激发

IE9 PHP和会话通过ajax在卸载时销毁-在刷新页面上激发,php,ajax,session,internet-explorer-9,Php,Ajax,Session,Internet Explorer 9,我对IE9有一个奇怪的问题,没有在任何其他IE中测试它-当我登录到网站时,每当我刷新页面时,都会触发以下代码: jQuery(window).bind("beforeunload", function() { $.get('session_destroy.php', function() { // alert('done'); }); }); 有趣的是,当我调用开发工具F12——然后刷新时,我可以看到一个对session_destroy.php的快速调用——但它不会让

我对IE9有一个奇怪的问题,没有在任何其他IE中测试它-当我登录到网站时,每当我刷新页面时,都会触发以下代码:

jQuery(window).bind("beforeunload", function() {
    $.get('session_destroy.php', function() {
    //  alert('done');
    });
});
有趣的是,当我调用开发工具F12——然后刷新时,我可以看到一个对session_destroy.php的快速调用——但它不会让我在刷新时注销

以下是我的文档定义:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> //- note this i need because on intranet sites IE gt 8 force compatibility mode of IE7 - this makes all jquery sucks..
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

在Firefox和Chrome中一切正常

关闭浏览器时,会话将被破坏。为什么要用javascript来实现这一点?这不是我的问题,不,它不会像那样在浏览器关闭时被破坏。这就是为什么我必须拥有itLies,在浏览器关闭时会话将被破坏!我认为你必须更多地了解@Bondye-是的,我知道!但是chrome喜欢回到上次捕获的数据!所以,尽管会话被破坏,它仍然会像用户仍然登录一样打开。用户在假会话期间所做的所有修改都无法保存。所以必须告诉chrome会话被破坏了。好了,现在开始讨论这个话题。1.“提交”按钮。单击“无法正常工作”。使用该函数。2.我发现你没有很好地使用ajax。考虑使用DoeFoe{{AlctEngult};},FultFult{{Act惊恐;}解释3。使用更好的DOCTYPE
$(document).ready(function(){

    $("#submit").click(function(){
        username = $("#username").val();
        password = $("#password").val();
        $.ajax({
            type: "POST",
            url: "login_db.php",
            data: "username="+username+"&password="+password,
            success: function(html){
                if(html.length>0)
                {
                    switch(html)
                    {
                        case "1": tab = "Production";
                        break;
                        case "2": tab = "Recordings";
                        break;
                        default: tab = "Summary";
                    }
                    window.location.hash = '';
                    var url=window.location;

                    window.location.href= url+tab;
                    location.reload();
                }
                else
                {
                    $("#add_err").html("Wrong username or password");
                }
            }
        });
        return false;
    });
});