Php ajax成功功能不工作,但在firebug控制台中显示
我正在创建简单的搜索 这在不使用ajax的情况下是完美的,我使用ajax做到了这一点 在firebug控制台中显示响应数组,但在ajax成功函数中不会触发数据。为什么 PHP代码Php ajax成功功能不工作,但在firebug控制台中显示,php,javascript,jquery,html,ajax,Php,Javascript,Jquery,Html,Ajax,我正在创建简单的搜索 这在不使用ajax的情况下是完美的,我使用ajax做到了这一点 在firebug控制台中显示响应数组,但在ajax成功函数中不会触发数据。为什么 PHP代码 <?php include('RO_dbconfig.php'); $search =$_GET['search']; $sql=$dbconnect->prepare("SELECT student_name FROM student_reg WHERE reg_id='$search'"); $sq
<?php
include('RO_dbconfig.php');
$search =$_GET['search'];
$sql=$dbconnect->prepare("SELECT student_name FROM student_reg WHERE reg_id='$search'");
$sql->execute();
$result=$sql->fetchALL();
var_dump($result);
?>
HTML
<form id="searchForm" class="form-horizontal">
<div class="control-group">
<label class="control-label label_al" for="inputStNum">Student No:</label>
<div class="input-append">
<input type="text" id="searchText" class="span2 span11" name="search">
<input type="submit" id="serachSubmit" class="btn buttnn" value="Search"/>
</div>
</form>
学号:
拼写错误
请查看您的ajax代码,而不是
succuss:function(e){
writesuccess:function(e){请查看您的ajax代码。它有一个关于succuss的拼写错误。实际上它将是success
AJAX:
你这里有打字错误
替换
succuss:function(e)
与
它应该是success
而不是succuss
succuss
=>success
:facepalm:用于upvoter。
$("#serachSubmit").click(function(event){
event.preventDefault();
var data =$("#searchForm").serialize();
//$("#response").html(data);
$.ajax({
type:"GET",
url:"search.php",
data:data,
success:function(e){
alert(e);
}
});
});
succuss:function(e)
success:function(e)