I have a loginout.php like:
<?php if($isLoggedIn) { ?>
<form method="POST" action="" name="logoutForm" id="logoutForm" accept-charset='UTF-8'>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type="submit" name="logout" value="Logout" />
</form>
<? } else { ?>
<form method="POST" action="" name="loginForm" id="loginForm" accept-charset='UTF-8'>
<input type='hidden' name='submitted' id='submitted' value='1'/>
Email: <input type="text" name="usr" /><br />
Password: <input type="password" name="pw" /><br />
<input type="submit" name="login" value="Login" />
</form>
<? }?>
a div like
<div id="loginLogoutDiv"></div>
and also jquery code:
$(document).ready(function(){
$('#loginLogoutDiv').load('loginout.php');
$('#loginForm, #logoutForm').live('submitted', function() {
$.post('loginout.php', $(this).serialize(), function (
data, textStatus) {
$('#loginLogoutDiv').html(data);
});
return false;
});
});
What is wrong if pressing the Login button, then whole page is refreshed that i don't want?
Thank you