提交后插入不了数据 是我ajax写的不对吧?
tt.php
ajax.php
prepare("insert into ajax(txt)values(?)");
$stmt->execute(array($txt));
?>
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
1、提交按钮点击默认会触发onsubmit事件,而你给它绑定的onclick事件里没有取消默认事件;
2、采用默认onsubmit,无视ajax,txt1加上name="aa";