I want to make an alert with code below but it returns me
Warning: Undefined array key "note" in ...\function.php on line 69.
I don't know much about Ajax so don't laugh if it's ridicules. Please help me, Thank you.
This is my script code:
var text = document.getelementsByClassName('text')[0];
var xhttp = new XMLHttpRequest();
xhttp.open('GET','function.php?note='+str,true);
xhttp.send();
xhttp.onreadystatechange = function() {
  if(xhttp.readyState == 4 && xhttp.status == 200) {
    text.innerHTML = xhttp.responseText;
  }
}
and my function.php code:
function entrance() {
    global $connect;
    if (isset($_POST['Esubmit'])) {
        $sql = "SELECT * FROM work WHERE username=? AND password=?";
        $result = $connect->prepare($sql);
        $result->bindvalue(1,$_POST['username']);
        $result->bindvalue(2,MD5($_POST['password']));
        $result->execute();
        if ($result->rowcount()){
            //do something
        } else {
            $note = $_REQUEST["note"];
            echo $note = "something";
            return false;
        }
    }
}
html code:
<?php entrance();?>
<form method="post" class="form1">
                <input type="text" name="username" placeholder="username" ><hr>
                <input type="password" name="password" placeholder="*****" ><br><br>
                <input type="submit" name="Esubmit" value="sign in" class="submit"><br><br>
                <p class="text"></p>
</form>
Once again, many thanks.
 
    