Hi,
I was wondering if it is possible to use with jQuery an hash string returned by the PHP function password_hash
.
I want to use that hash for identify a particular element in the page.
This is my example, but, it throws an error as:
Syntax error, unrecognized expression: #$2y$10$gGtfwaitcXzQb/r6FCRE4uKu0hqPKh5jGHc29/FLPvMQWS0SvdRty
.
Please, can you tell me if is it possible to resolve that? Many thanks!
<?php
$email = "email@domain.com";
$hash = password_hash($email, PASSWORD_DEFAULT);
?>
<!DOCTYPE html>
<html lang='it'>
<head>
<title></title>
<meta charset='utf-8'>
<meta name='description' content=''>
<meta name='keywords' content=''>
<meta name='author' content=''>
<meta name='robots' content='all'>
<!-- <meta http-equiv='X-UA-Compatible' content='IE=edge'> -->
<link href='/favicon.png' rel='shortcut icon' type='image/png'>
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script>
$(function () {
var hash = $("div[name='box']").attr("id");
$('#' + hash).html("hello");
console.log(hash);
});
</script>
</head>
<body>
<p>Email:</p>
<div name='box' id='<?= $hash ?>'></div>
</body>
</html>