title: logout using AJAX is not working properly
body: <p>i want to logout on clicking this button </p>
  
  <p><strong>html input</strong></p>
  
  <pre><code>&lt;input type="button" value="logout" id="top-btn-logout" onclick="test()"&gt; 
  </code></pre>
  
  <p><strong>my js file</strong></p>
  
  <pre><code>function test()
  {
      $("#top-btn-logout").click(function() {
          $.ajax({
              url: 'http://localhost/New%20folder/vigcheck.php?action=logout',
              success: function(data){
              alert(data);
                     //location.reload();
                  //window.location.href = data;
              }
          });
      });
  
  
  }  
  
  
  
  check.php file.   
  
  &lt;?php
  if(isset($_GET['action']) == "logout" ){
  
      //$_SESSION = array();
      session_destroy();
      session_unset();  
      echo "logout";exit;
  }?&gt;
  </code></pre>