这是我的代码
<!DOCTYPE html>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script>
function loginProcess()
{
$.ajax({
type: 'GET',
url: 'loginProcess.php',
data:
{
uname:$("#userName").val(),
pass:$("#pass").val(),
rem:$("#remVal").val()
},
cache: false,
success: function(data)
{
if(data == 1)
{
location.href="home.php";
}
else
{
location.href="index.php";
}
}
});
}
function ckLogin(e)
{
if(e.keyCode == 13)
{
loginProcess();
}
}
<li>
<font size="1px"> Username: </font>
<input type="text" id="userName" name="userName" value="kamalesh" onKeyUp="ckLogin(event);" required="required" />
</li>
<li>
<font size="1px"> Password: </font>
<input type="password" id="pass" name="pass" value="kamalesh" onKeyUp="ckLogin(event);" required="required" />
</li>
<li>
<span><font size="1px"> Remember me: </font></span>
<select data-role=slider id="remVal">
<option value=no> No </option>
<option value=yes> Yes </option>
</select>
</li>
<li><input type="button" value="LogIn" onClick="loginProcess();"/></li>
</ul>
</form>
</div>
</div>
</body>
</html>