好的…类似这样的东西…但是我没有尝试过…所以像教程一样使用它。您也可以使用json
js:
function processForm() { $.ajax( { type: 'POST', url: form_process.php, data: 'user_name=' + enpreURIComponent(document.getElementById('user_name').value), success: function(data) { $('#message').html(data); } } );}
HTML:
<form action="" method="post" onsubmit="processForm();return false;"><input type='text' name='user_name' id='user_name' value='' /><input type='submit' name='submit' value='submit'/></form><div id='message'></div>
form_process.php
$user_name = $_POST['user_name'];if(do something){ echo "login success";else{ echo "login unsuccessful";}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)