From dd07efcac7f4e9eed20b3c65047019aff694a9d7 Mon Sep 17 00:00:00 2001 From: Suhaib Khan Date: Fri, 21 Feb 2014 13:01:22 +0530 Subject: [ticket/10737] Using JQuery events and JSON response. PHPBB3-10737 --- phpBB/assets/javascript/core.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'phpBB/assets/javascript') diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index ac866f7c78..c2291c7001 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -512,6 +512,32 @@ phpbb.timezonePreselectSelect = function(forceSelector) { } }; +// Listen live search box events +$('.liveinput').keyup(function() { + var str = this.value; + var j = 0; + if (str.length < 3) { + $("#livesearch").innerHTML=""; + return; + } + + $.ajax({ + url:'memberlist.php?mode=livesearch&'+"&q="+str, + success:function(result) { + $.each(result, function(idx, elem) { + j = (idx%2)+1; + $("#livesearch").append("" + elem.name + ""); + }) + } + }); +}); + +$('.liveinput').blur(function() { + setTimeout(function () { + document.getElementById("livesearch").innerHTML=""; + }, 500); +}); + // Toggle notification list $('#notification_list_button').click(function(e) { $('#notification_list').toggle(); -- cgit v1.2.1