How to make a script that loads the div after you enter the password?

How to make a script that loads the div after you enter the password?
The idea is that I need to make a page which will podruzhatsya after entering the password.
Maybe someone knows how this is implemented? Thanks in advance!
June 10th 19 at 15:08
1 answer
June 10th 19 at 15:10
in the html form and a div output
<input id="login">
<input type="password" id="password">
<button onclick="getDiv()">Press here</button>
<div id="output"></div>

Then you can put Jquery code or in a separate file, as you prefer
the <script>
 function getDiv() {
 $('#output').load('my_script.php', {
login:$('#login').val(),
password:$('#password').val()
});
}
</script>

Well, the handler for php (my_script.php)
<?php
echo 'was received login:' . $_REQUEST['login'] . 'and password:' . $_REQUEST['password'];</code-->
How to cut(remove) a field with the username? You only need the password field - Kayley_VonRueden42 commented on June 10th 19 at 15:13
simply remove it from the html code of the send function this field in the php file.
<input type="password" id="password">
<button onclick="getDiv()">Press here</button>
<div id="output"></div>

function getDiv() {
 $('#output').load('my_script.php', {
password:$('#password').val()
});
 }

echo 'was received password:' . $_REQUEST['password'];
- Roderick92 commented on June 10th 19 at 15:16
I do not understand how it should work. Set all as you said. Where is the password? Where to specify the correct password? - Kayley_VonRueden42 commented on June 10th 19 at 15:19
Sent by the user password comes in $_REQUEST['password'] or $_POST['password']. Can compare one of these variables, with the password stored in your database. Then in php file is like this.
echo ($_REQUEST['password'] == $password)?"The password is correct":"wrong Password";
- Roderick92 commented on June 10th 19 at 15:22

Find more questions by tags AJAXHTMLJavaScript