AJAX/PHP Error on showing "Success": Uncaught TypeError: undefined is not a function

AJAX/PHP Error on showing "Success": Uncaught TypeError: undefined is not a function

我需要帮助。我构建了一个 "search" 表单来搜索数据库并通过 AJAX 发送它。问题是,内容已交付,结果也显示在 Google Chrome Web Develeloper Tools under Requests -> Preview 中,但不在屏幕上。结果蜂拥而至。

但是当我想用灯箱在屏幕上显示结果时出现错误:http://i.stack.imgur.com/IBmZ4.png

我的代码, jQuery POST AJAX

function submitDetailsForm() {
 $('#searchit').submit(function() {
        var content = $("#searchit_input").val();
        var dataString = 'content='+ content;
        if(content == '') { alert("Nothing here."); } else {
            $.ajax({
            type: "POST",
            url: "/ajax/search.php",
            data: dataString,
            cache: false,
            success: function(result){
             $.lightbox("/ajax/search.php", {
    'width'       : 610,
    'height'      : 458,
    'autoresize'  : true
  });;
            }

            });
            }       
        return false;   
    });
}

SEARCH.php

<?php
$Results = $connection->query("SELECT * FROM wp_posts WHERE post_status = 'publish' AND post_title LIKE '%$content%' AND keywords LIKE '%$content%' AND topstory != '' ORDER BY post_modified DESC LIMIT 8"); 
    if (mysqli_num_rows($Results) < 1) {    

        echo "Nothing found.."; 
    } else {


        while($Show = $Results->fetch_object()) {
        $Title =  $Show->post_title; 
        $Topstory = $Show->topstory;
        $Description = $Show->longdesc;
        $id = $Show->ID;




?>
hi
<?php
        }
    }
?>

提前谢谢你。 :)

您没有使用灯箱在屏幕上显示 result。您根本没有使用 result。很可能这就是您的问题所在。

$.ajax({
    type: "POST",
    url: "/ajax/search.php",
    data: dataString,
    cache: false,
    success: function(result) {
        // you need to actually do something with `result` in here to
        // actually use the result of your ajax call.
    }
});

你没有说明你使用的是哪个灯箱插件,所以我不知道它应该如何工作,但可以肯定的是你没有设置它来做你想做的事。