JQuery:实时搜索 - 没有div自动更新

时间:2014-09-15 22:08:15

标签: javascript jquery search get

现在我正在尝试编写用于实时搜索的脚本。这里的问题是:脚本只工作一次,然后div没有更新。我的概念:在搜索表单中捕获按键,并在每次按下任何键时将结果放入div。

              <script>

                $(document).ready(function(){
                var poisk_val = $('#poisk').val();
                function sendAjaxGET(_data,_url){
                    $.ajax({
            type:'GET',
            url:_url,
            data:_data,
            cache:false
                    });
                }
function AjaxResultat(_data,_blres,_divname,_url){
        $.ajax({
            type:'GET',
            url:_url,
            data:_data,
            cache:true,
            success:function(resultat){
                $('.info_'+_blres).html(resultat).show();
                $('#backgroundPopup').fadeIn(500);
                $(_divname).fadeIn(500);
                $('body').bind("keydown", function(event) {
        if (event.which === 27) { // 27 is 'Ecs' in the keyboard
          $(_divname).fadeOut(500);
          $('#backgroundPopup').fadeOut(500);  // function close pop up
       }
           });
                $('.close').click(function() {
    $(_divname).fadeOut(500);
    $('#backgroundPopup').fadeOut(500);
    });
    $(".close").hover(
                    function() {
                        $('span.ecs_tooltip').fadeIn(500);
                    },
                    function () {
                        $('span.ecs_tooltip').fadeOut(500);
                    }
                );

            }

    });
    return false;
    }
                function genSecurityID(){
                //    eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(c/a))+String.fromCharCode(c%a+161)};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\[\xa1-\xff]+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp(e(c),'g'),k[c])}}return p}('m=¡(m);n=¡(n);£ ¢.¤(¢.¥()*(n-m+1))+m;',5,5,'parseInt|Math|return|floor|random'.split('|'),0,{}))
m = +(+!+[]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+[!+[]+!+[]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+[+!+[]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]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]]() * (n - m + +!+[]) ) + m;
}
                var securityID = genSecurityID();


        $('#poisk').keydown(function(){ 
                    var data = {'search':poisk_val, '_':securityID};
                    AjaxResultat(data,'search','.search_res','?view=live_search');
                    alert(data);
                });
                });
            </script>

0 个答案:

没有答案