AJAX not requesting page properly

My problem is that when i click on “Change Passoword” it displays the contents of settings.php and then fades out immediately. I want that when somebody clicks on “Change Password”, they will on the same page see the form for changing password, with the URL as www.site.com/settings/index.php?tab=password. But when i click, it shows the form but, vanishes.

<?php
session_start();

if(!$_SESSION['user_status'])
  header("Location: ../login.php");


require_once '../includes/connect.php';
require_once '../functions/siteFunctions.php';
require_once '../includes/activeheader.php';
require_once '../functions/confooter.php';

$msg="";

if(isset($_POST['submit']))
 {
  if(empty($_POST['oldpass']) || empty($_POST['newpass']) || empty($_POST['rNewPass']) )
   $msg="All fields are required";
 }

if(isset($_POST['submit']))
{
  $old_password=$_POST['oldpass'];
  $new_password=$_POST['newpass'];
  $re_password=$_POST['rNewPass'];
  $msg=changePassword($_SESSION['uid'],$old_password,$new_password,$re_password);
}          

?>

<html>
<head>
 <link rel="stylesheet" type="text/css" href="../style.css">
 <script>
   
   var rqst;

   rqst = new XMLHttpRequest();
   
   function changePass() {
    rqst.onreadystatechange = function() {
       if(rqst.readyState==4 && rqst.status==200) 
         document.getElementById('container_flt_cXygio_01').innerHTML=rqst.responseText;
         else 
          document.getElementById('container_flt_cXygio_01').innerHTML=rqst.statusText;
    }
    rqst.open("POST","settings.php",true);
    rqst.send();
   }

 </script>
</head>
<title>Accounts Settings</title>
<body>
	<style type="text/css">
      #old_pass_lb {
      	font-size: 15px;
      }
       input.chg_yXcq03 {
       background-color: orangered;
       padding: 7px;
       font-size: 14px;
       font-family: calibri, sans-serif;
      }

    input.chg_yXcq03:hover {
    background-color: rgb(237, 135, 98);
    cursor: pointer;
    }

    p.cXyuPpwD_01 {
        color: red;
      }

      li#cXyoig05_15 {
  list-style-type: none;
}

table.frgt_pass_frm_cXygIo15 {
  /* margin-top: 20px; */
  margin-left: 32px;
  /* margin-bottom: 10px; */
  padding: 20px 47px 7px 52px;
  border: 1px solid;
}

div#updt_info {
  padding-left: 20px;
  padding-right: 157px;
  margin-left: 960px;
  margin-right: 57px;
}

li#pdliu_2277 {
  list-style-type: none;
}

	</style>

<div id='setting_cXygi01_sidebar_left' align="left">
  <table class="cXyhio02_setting_option_left">
     <a href="index.php?tab=password" onclick="changePass()">Change Passoword</a>
  </table>
</div>
<div id="container_flt_cXygio_01">
</div>
</div>
</body>
</html>

that’s because the browser follows the link and loads the given resource.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.