http://forrst.com/posts/jquery_livesearch_for_twentyten_theme-tV3 //livesearch.js jQuery(document).ready(function ($) { var contentCache, searched = false; jQuery('#searchform').submit(function () { var s = jQuery(this).find('#s').val(); if (s.length == 0) { return; } var submit = $('#searchsubmit'); submit.attr('disabled', false); var url = jQuery(this).attr('action') + '?s=' + encodeURIComponent(s) + '&action=search_ajax' jQuery.ajax({ url: url, type: 'get', dataType: 'html', beforeSend: function () { submit.attr('disabled', true).fadeTo('slow', 0.5); document.body.style.cursor = 'wait'; var load = '

Searching...

'; jQuery('#container').empty().html(load); }, success: function (data) { submit.attr('disabled', false).fadeTo('slow', 1); document.body.style.cursor = 'auto'; jQuery('#container').empty().html(data); jQuery('#ajaxback').click(function () { jQuery('#container').empty().html(contentCache); }); } }); return false; }); var timer, currentKey; jQuery('#s').keyup(function () { clearTimeout(timer); timer = setTimeout(function () { var sInput = jQuery('#s'); var s = sInput.val(); if (s.length == 0) { if (searched) { jQuery('#container').empty().html(contentCache); sInput.focus(); //jQuery('#search-form span.processing').remove(); searched = false; } currentKey = s; } else { if (s != currentKey) { if (!searched) { contentCache = jQuery('#container')[0].innerHTML; searched = true; } currentKey = s; if (s != ' ') { jQuery('#searchform').submit(); jQuery('#s').attr('value',''); } } } }, 800); }); }); //functions.php add_action('init','ajax_live_search_js'); function ajax_live_search_js() { wp_enqueue_script('jquery'); wp_register_script('ajax_live_search', get_bloginfo('stylesheet_directory') . '/js/2010.js', array('jquery'), '1.0'); wp_enqueue_script('ajax_live_search'); } function ajax_live_search_template() { if (is_search()) { include(dirname(__FILE__) . '/livesearch.php'); exit; } } add_action('template_redirect','ajax_live_search_template'); //livesearch.php '; } else { $do_ajax =1;} ?>

' . get_search_query() . ''); ?>

Go back to last page?';} ?>

'; get_sidebar(); get_footer(); } ?>