Jquery函数赢得´;在XMLHttpRequest之后无法工作

Jquery函数赢得´;在XMLHttpRequest之后无法工作,jquery,ajax,events,xmlhttprequest,handler,Jquery,Ajax,Events,Xmlhttprequest,Handler,我有一个div(#div_eventos),它通过XMLHttpRequest更新,以更新其中包含的数据。我还有一个在输入文本字段中键入时执行的函数。当在搜索字段(输入文本)上查找一致性时,此函数会隐藏或显示表格行。但在div_eventos更新后,该函数不再工作 以下是我希望在div更新后执行的函数: $(document).on("keyup", "input#search", function(){ var filter = $(this).val(

我有一个div(#div_eventos),它通过XMLHttpRequest更新,以更新其中包含的数据。我还有一个在输入文本字段中键入时执行的函数。当在搜索字段(输入文本)上查找一致性时,此函数会隐藏或显示表格行。但在div_eventos更新后,该函数不再工作

以下是我希望在div更新后执行的函数:

$(document).on("keyup", "input#search", function(){
                    var filter = $(this).val();
                    var regExPattern = "gi";
                    var regEx = new RegExp(filter, regExPattern);
                    $("table tr").each(function () {
                        if($(this).data('state'))
                        if (
                        $(this).text().search(new RegExp(filter, "i")) < 0
                        && $(this).data('state').search(regEx) < 0
                        ){
                            $(this).hide();
                        } else {
                            $(this).show();
                        }
                    });
                });
$(文档).on(“键控”,“输入#搜索”,函数()){
var filter=$(this.val();
var regexpatern=“gi”;
var regEx=新的RegExp(过滤器,regexpatern);
$(“表tr”)。每个(函数(){
if($(this).data('state'))
如果(
$(this.text().search(新的RegExp(filter,“i”))<0
&&$(this).data('state').search(regEx)<0
){
$(this.hide();
}否则{
$(this.show();
}
});
});
以下是已更新的div:

<div id="div_eventos">                
            <table class="estilo_original" width="100%">            
            <tbody>
            <?php       
                for($i=0; $i < count($lecturas_sitios) ; $i++)
                {
                    $cadena_lecturas="";
                    echo '<tr data-state="california">';
                    echo '<td>';
                    echo ($i+1).". <a href='presas.php?sitio=".$lecturas_id[$i]."&tabla=".$lecturas_tabla[$i]."'>".$lecturas_sitios[$i]."/".$lecturas_distrito[$i]." </a> <img src='images/".$lecturas_modo_comunicacion[$i]."' title='Modo de Comunicacion' width='24px' height='24px'>";
                    echo '</td>';
                    echo '<td>';
                    echo $lecturas_medidor_marca[$i]."-".$lecturas_medidor_modelo[$i]."</br>".$lecturas_medidor_tipo[$i];
                    echo '</td>';
                    echo '<td>';
                    echo $lecturas_flujo[$i];
                    echo '</td>';
                    echo '<td>';
                    echo number_format($lecturas_volumen[$i]);
                    echo '</td>';

                    echo '<td>';
                    if(strtolower($lecturas_medidor_marca[$i])=='panametrics')
                        echo "-";
                    else
                        echo $lecturas_nivel[$i];
                    echo '</td>';
                    echo '<td>';
                    if($nivel == 1)
                        echo $lecturas_fecha[$i]." &nbsp;&nbsp; <img src='images/".$lecturas_led[$i]."' title='".$lecturas_minutos_desconectado[$i]." horas desde última lectura' width='15px' height='15px'>";
                    else
                        echo $lecturas_fecha[$i]." &nbsp;";
                    echo '</td>';
                    echo '</tr>';
                }
                odbc_close($conn);
            ?>
            </tbody>
            </table>

我已尝试通过委派函数(.on)来更新事件,但仍然不起作用。你能给我一些建议吗


感谢您

更新的DIV中没有
id=“search”
。很抱歉,id=“search”的输入文本在反更新的DIV之外,这是代码:[code][/code]如果您没有动态创建搜索字段,则不需要使用委托绑定处理程序。你确定该函数没有执行吗?谢谢Barmar,确实文本字段不是自动创建的,但是当我在该字段上键入时,它会影响更新的DIV的内容,DIV会从服务器每隔60秒自动更新一次。因此,当DIV第一次更新时,函数不再执行。那么,您知道如何在数据更新后jQuery仍然检测到DIV内容吗?到目前为止,您做了哪些故障排除工作?如果将
alert
console.log
放入函数中,是否看到它?