JQuery çalışmıyor

0 Cevap php

Nedense, benim jQuery düzgün çalışmıyor, ve ben bir fikir olabilir, ancak ben hata nokta olamaz. Aşağıda group2.php gelen bazı kod, onun bir sohbet uygulaması için:

<div id="wrapper">
    <div id="menu">
        <p class="welcome">Welcome, <b><?php echo $_SESSION['name']; ?></b></p>
        <p class="logout"><a id="exit" href="?logout=1">Exit Group</a></p>
        <div style="clear:both"></div>
    </div>  

   if(isset($_GET['logout'])){  
     $fp = fopen("log.html", 'w');
     fwrite($fp, "");
     fwrite($fp, "<div class='msgln'><i>User " . $_SESSION['name'] . " has left the chat session.</i><br></div>");
     fclose($fp);       
     session_destroy();
     header("Location: main.php"); //Redirect the user        
     }



?>
</div>

While below is jQuery, which is also in group2.php, where I am trying to see if the user clicked logout, then we should direct to main.php?logout=true

//If user wants to end session
    $("#exit").click(function(){
      var exit = confirm("Are you sure you want to end the session?");
      if(exit==true){ window.location = 'main.php?logout=true';
      }
    }); 

I if(isset($_GET['logout'])) içindeki kodu çalıştırmak ve onlar odadan isteyip istemediğinizi kullanıcı sormak mümkün duyuyorum iken onlar Tamam 'ı tıklatın sonra, ben main.php?logout=true için kullanıcı yönlendirmek için alamıyorum 'sorusuna' oturumunu sonlandırmak ister misiniz? '. Bunun yerine, kullanıcı ?logout=1 yöneliktir edilmektedir. Ben ne yapıyorum yanlış herhangi bir öneriniz? Teşekkür ederim.

0 Cevap