<div id="data_Modalgantipassworduser" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog ">
  <div class="modal-content">
   <div class="modal-header">
    <h4 class="modal-title">UserName :<?php echo " ".$_SESSION['username']; ?></h4>
   
   </div>

   <div class="modal-body">
    <form class="form-updateuser" id="form-updateuser">
     <label>Pasword Baru</label>
     <input type="password" name="password" id="password" class="form-control " required="password">
     <label>Ulangi</label>
     <input type="password" name="password1" id="password1" class="form-control " required="password1">
     </div>

    <div class="modal-footer">
     <input type="button" name=" updateuser" id="updateuser" value="Simpan" class=" btn btn-primary" onkeypress="nextfield('close')"/>
      <button type="button" name="close" class=" btn btn-danger" data-dismiss="modal">Close</button>

    </div>
    </form>



</div>
  </div>
 </div>



<script type="text/javascript">

    

    $(document).ready(function(){

    $("#updateuser").click(function(){

      var data = $('#form-updateuser').serialize();

      var password= $('#password').val();

      var password1= $('#password1').val();

     

      if(password== "0"|| password=="" || password1==0 ||password1==""){ 

        alert ("Data Masih ada yang kosong");

        /*window.location.href='/rakerugt/home.php?page=home';*/

       }else if(password !== password1){

            alert ("password yang dimasukkan tidak sama");

       

       }else{

      $.ajax({

        type: 'POST',

        url: 'simpan/update_gantipasword.php',

        data: {password:password,password1:password1},

        success: function(data) {

         console.log(data)

         alert("Data Sukses Disimpan----!");

         window.location.href='/gadai/home.php?home=7eec54842ae92700ea21f7289a2ed383';       

        },

        error: function(error){

          console.log(`error ${error}`)

        }

      });

    }

    });

  });



</script>



