diff options
author | Suhaib Khan <suhebjerk@gmail.com> | 2014-02-21 13:01:22 +0530 |
---|---|---|
committer | Cesar G <prototech91@gmail.com> | 2014-04-23 09:11:39 -0700 |
commit | dd07efcac7f4e9eed20b3c65047019aff694a9d7 (patch) | |
tree | de5715c8d3e228c6088af38952e67f20ffabf9c2 /phpBB/assets/javascript | |
parent | b5ee81dae6f097e97049a756763d1b3119f61573 (diff) | |
download | forums-dd07efcac7f4e9eed20b3c65047019aff694a9d7.tar forums-dd07efcac7f4e9eed20b3c65047019aff694a9d7.tar.gz forums-dd07efcac7f4e9eed20b3c65047019aff694a9d7.tar.bz2 forums-dd07efcac7f4e9eed20b3c65047019aff694a9d7.tar.xz forums-dd07efcac7f4e9eed20b3c65047019aff694a9d7.zip |
[ticket/10737] Using JQuery events and JSON response.
PHPBB3-10737
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r-- | phpBB/assets/javascript/core.js | 26 |
1 files changed, 26 insertions, 0 deletions
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("<tr class='bg" + j + " row" + j + "'><td><a href='memberlist.php?mode=viewprofile&u=" + elem.id + "' target='_blank'>" + elem.name + "</a></td></tr>"); + }) + } + }); +}); + +$('.liveinput').blur(function() { + setTimeout(function () { + document.getElementById("livesearch").innerHTML=""; + }, 500); +}); + // Toggle notification list $('#notification_list_button').click(function(e) { $('#notification_list').toggle(); |