Home > Article > Backend Development > php用ajax为啥只能返回数字
php用ajax为什么只能返回数字
<br /> //提交表单<br /> function subm(){<br /> var user = $('#frm').serialize();<br /> $.ajax({<br /> url: 'b.php',<br /> type: 'POST',<br /> data:user,<br /> contentType:"application/json",<br /> dataType: 'json',<br /> async:false,<br /> beforeSend: function(){<br /> alert('Error loading PHP document');<br /> },<br /> success: function(result){<br /> alert(result);<br /> }<br /> });<br /> }<br />
<br /> <form id="frm" action="" method="post" onsubmit="subm()"><br /> <input<br /> id="user" name="username" /><br /><br /> <input id="password" type="password" name="password" /><br /><br /> <br /> <input type="submit" value="提交" /></form>