I'm trying to make a simple login form in php and html and it just won't print the echo into my div container I must be using the load function incorrectly but I don't quite know how to fix it.
Here is my html/script code.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<script src="js/jquery-3.1.0.min.js"></script>
<script type="application/javascript">
$(document).ready(function(){
$("#cargar").click(function(){
var u = $("#username").val();
var v = $("#password").val();
$.get("login.php",{username:u,password:v});
$("#contenedor").load('login.php')
});
});
</script>
<body>
<form>
User name:<br>
<input id="username" type="text" name="username" />
<br>
User password:<br>
<input id="password" type="text" name="password"><br>
<input id="cargar" type="button" value="cargar" />
</form>
<div id="contenedor"></div>
</body>
</html>
And here is my php
<?php
$usuario = $_REQUEST['username'];
$contra = $_REQUEST['password'];
if($usuario=="admin" && $contra=="admin"){
echo "<h2>Bienvenido</h2>";}
else{
"<h2>Error</h2>";
}
?>