所有的源码都在这里,百度有人说不能把PHP和Html放在一个文件里面,但是我的都是分开放在单独的文件里面,不知道为什么会直接返回PHP代码,各位大神请直接
<form>
用户名:<input type="text" name="user" id="user">
邮件:<input type="text" name="email" id="email">
<input type="button" value="提交">
</form>
$(function(){
$('form input[type=button]').click(function(){
$.ajax({
type:'POST',
url:'user.php',
data:$('form').serialize(),
success:function(response,status,xhr){
$('#box').html(response);
}
});
});
})
<?php
echo $_POST['user'].'-'.$_POST['email'];
?>
环境还没配对,先能输出phpinfo()再忙活下面的吧