日期:2014-05-16 浏览次数:20361 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> </head> <body> <form method="post" action="test.php"> <input type="text" id="m_id"/> <input type="submit" onclick="return preSubmit()"/> </form> <script type="text/javascript"> function preSubmit(){ var mID = $("#m_id").val(); $.ajax({ type : "GET", cache : false, url : "test.php?id="+mID, dataType : 'text', success: function (data){ if(data == 1){ return false; }else{ return true; } } }); return false; } </script> </body> </html>
<?php if(isset($_POST['id'])) { echo $_POST['id']."已提交"; } $id = $_GET['id']; echo $id;