简体   繁体   English

ajax succuss函数不起作用,但在萤火虫控制台中显示

[英]ajax succuss function not working but showing in the firebug console

I am creating simple search. 我正在创建简单的搜索。

This is work perfect without using ajax and I did it with ajax. 无需使用ajax,这是完美的工作,而我使用ajax做到了。

In firebug console showing the response array but in ajax success function does not trigger the data.why? Firebug控制台中显示响应数组但在ajax中,成功函数不会触发数据。为什么?

PHP CODE PHP代码

<?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);    
?>

AJAX AJAX

$("#serachSubmit").click(function(event){
    event.preventDefault();
    var data =$("#searchForm").serialize();
    //$("#response").html(data);
    $.ajax({            
        type:"GET",
        url:"search.php",
        data:data,

        succuss:function(e){
            alert(e);

            }           
        });     
    });

HTML 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>

Misspelled 拼写错误

Instead of succuss:function(e){ write success:function(e){ 代替succuss:function(e){编写success:function(e){

Please look on your ajax code. 请查看您的Ajax代码。 It has a misspelled about succuss . 关于夫妻关系的拼写错误。 Actually it will be success 其实会成功

AJAX : http://api.jquery.com/jQuery.ajax/ AJAXhttp//api.jquery.com/jQuery.ajax/

$("#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);

        }           
    });     
});

you have typo here 你在这里有错字

replace 更换

succuss:function(e)

with

 success:function(e)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM