最新消息: 新版网站上线了!!!

php jquery ajax简单的登陆实例

jquery ajax和简单实例
<script type="text/javascript">
$(document).ready(function() {
 
$("#login").click(function() {
 
var action = $("#form1").attr('action');
var form_data = {
username: $("#username").val(),
password: $("#password").val(),
is_ajax: 1
};
 
$.ajax({
type: "POST",
url: action,
data: form_data,
success: function(response)
{
if(response == 'success')
$("#form1").slideUp('slow', function() {
$("#message").html("<p class='success'>You have logged in successfully!</p>");
});
else
$("#message").html("<p class='error'>Invalid username and/or password.</p>");
}
});
 
return false;
});
 
});

转载请注明:谷谷点程序 » php jquery ajax简单的登陆实例