ajax form表单提交

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ajax submit</title>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script>
/*$(document).on('submit', 'form', function(){
alert('123');
$.post(url, data, function(data){
}, 'json');
return false;
});*/
$(document).ready(function(){
$('input:submit').click(function(){
alert('tewet');
return false;
});

$('#load_text').load('test2.php', {limit:25}, function(data){
alert(data);
});
});
</script>
</head>

<body>
<form action="test2.php" method="post">
<input type="text" name="name" value="" />
<input type="submit" value="submit" />
</form>
<p id="load_text"></p>
</body>
</html>

posted @ 2012-11-02 11:14  幻星宇  阅读(250)  评论(0编辑  收藏  举报