I’m attempting to return results from PHP to a div id=loginstart located on home.html, however the results fail to appear. I’ve tried troubleshooting for over 24hrs but I haven’t been able to find anything that works. Any ideas?
[html]
<head>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#checklogin").validate({
debug: false,
rules: {
name: "required",
email: "required",
},
messages: {
name: "Please enter your Username.",
email: "Please enter your Password.",
},
submitHandler: function(form) {
$.post("php/Login.php", $("#myform").serialize(), function(html) {
$("#LoginResult").html(html);
});
}
});
});
$(document).ready(function(){
$.post('php/Users.php', '', function(data) {
$('#loginstart').html(data);
});
});
</script>
</head>
<body>
<div class="sidebar-content-left">
<div id="LoginResult"></div>
<div id="loginstart"></div>
</div>
</body
[users php]
Welcome ‘.$session_username.’Click here to Log Out. ‘;
}else{
echo '<h3>Welcome Guest,</h3>Please log in to use Connect-A-Bull Marketplace.<br /><br /><form name="login" id="login" action="" method="POST">Username<br/><input name="Username" id="Username" type="text" /><br/>Password<br/><input name="Password" id="Password" type="password" /><br/><input name="Remember" id="Remember" type="checkbox" value="" />Keep me logged in<br/><input type="submit" class="sub-button" value="Log In" /><a href="Register.html" target="_parent"><input type="reset" class="sub-button" value="Register" /></a><br/><a href="PasswordReset.html" target="_parent"> Forgot Password</a></form>';
}
?>
Thank you for your time.
I don’t see any div with
id=loginstartin your code. Try changing it to$('#LoginResult').html(data);UPDATE:
Try adding your
<script>just before the closing</body>tag. Also check your error console in your browser for any possible javascript errors.