时间:2021-07-01 10:21:17 帮助过:40人阅读
$.ajax({
type: "post",
url: "nodedo.php",
data: $("#form1").serialize(),
success: function(data) {
layer.msg('添加成功', 2, 1);
},
error: function(data) {
layer.msg('添加失败', 2, 2);
alert(data);
}
})
$conn = mysql_connect("localhost","root","");
$my_db = mysql_select_db("lyq",$conn);
$account = $_POST['account'];
$sql = "insert into salesman(account) values ('$account')";
$result = mysql_query($sql, $conn);
$userInfo = mysql_fetch_assoc($result);
echo json_encode($userInfo);
$.post(
'nodedo.php',
{
account:$("#account").val(),
name:$("#name").val()
// name:$("#name").val()
},
function (data) { //回调函数
var myjson='';
eval('myjson=' + data + ';');
alert(data);
}
);