Compare commits
2 Commits
6b58de0033
...
7b7f866582
Author | SHA1 | Date | |
---|---|---|---|
7b7f866582 | |||
851b5156d7 |
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
require "../variables.php";
|
||||
require dirname(__FILE__) . "/../variables.php";
|
||||
|
||||
$dbbooks = array();
|
||||
$parsedbooks = array();
|
||||
|
|
10
js/books.js
10
js/books.js
|
@ -2,6 +2,7 @@
|
|||
var kindlemail = "";
|
||||
var currentpath = "";
|
||||
var searchTimeout = null;
|
||||
var lastSearch = "";
|
||||
|
||||
$(document).ready(function() {
|
||||
getContents();
|
||||
|
@ -35,6 +36,10 @@ $(document).ready(function() {
|
|||
$("#search").on("change keyup", function() {
|
||||
if ( searchTimeout ) clearTimeout(searchTimeout);
|
||||
if ( $("#search").val().length > 2 ) searchTimeout = setTimeout(getContents, 500);
|
||||
if ( ($("#search").val() == "") && (lastSearch != "") ) {
|
||||
lastSearch = "";
|
||||
getContents();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -50,7 +55,10 @@ function redirectToLogin() {
|
|||
function getContents() {
|
||||
if ( searchTimeout ) clearTimeout(searchTimeout);
|
||||
var data = {};
|
||||
if ( $("#search").val() != "" ) data.search = $("#search").val();
|
||||
if ( $("#search").val() != "" ) {
|
||||
data.search = $("#search").val();
|
||||
lastSearch = data.search;
|
||||
}
|
||||
$.ajax({
|
||||
url : 'ajax/getcontents.php',
|
||||
data : data,
|
||||
|
|
Loading…
Reference in New Issue
Block a user