$(function(){
$('[data-toggle="tooltip"]').tooltip({html:true});
});

$(function() {
  $("#reset_password_btn").click(function() {
	var new_password = $("input#new_password").val();
	var confirm_new_password = $("input#confirm_new_password").val();
	var user_id = $("input#user_id").val();
	var dataString = 'new_password='+ new_password +'&confirm_new_password='+ confirm_new_password+'&user_id='+ user_id;
	$("#reset_password_btn").append(' <span class="fa fa-spinner fa-spin"></span>');
	$.ajax({
      type: "POST",
      url: 'ajax.php?case=reset_password',
      data: dataString,
	  cache: false,
      success: function(result) {
	  if (result == 1) {
		  setTimeout(
		  function() 
		  {
	    $("#reset_password_btn span").remove();
		$("#reset-password-form").hide();
		$("div#reset-password-message").html('<div class="alert alert-success">'+success_reset_password+'</div>');
		}, 2000);
	  } else {
		$("#reset_password_btn span").remove();
	    $("div#reset-password-message").html(result);
	  }
      }
     });
    return false;
	});
});
