帮我看看ajax提交哪有问题
<br /> $.ajax({<br /> type: "post",<br /> url: "nodedo.php",<br /> data: $("#form1").serialize(),<br /> success: function(data) {<br /> layer.msg('添加成功', 2, 1);<br /> },<br /> error: function(data) {<br /> layer.msg('添加失败', 2, 2);<br /> alert(data);<br /> }<br /> })<br />
<br /> $conn = mysql_connect("localhost","root","");<br />$my_db = mysql_select_db("lyq",$conn);<br /> $account = $_POST['account'];<br /> $sql = "insert into salesman(account) values ('$account')";<br /> $result = mysql_query($sql, $conn);<br /> $userInfo = mysql_fetch_assoc($result);<br /> echo json_encode($userInfo);<br />
<br /> $.post(<br /> 'nodedo.php',<br /> {<br /> account:$("#account").val(),<br /> name:$("#name").val()<br /> // name:$("#name").val()<br /> },<br /> function (data) { //回调函数<br /> var myjson='';<br /> eval('myjson=' + data + ';');<br /> alert(data);<br /><br /> }<br /> );<br />