I have implemented ajax live search on my website.It does work for all browsers but when it comes to touchscreen it doesn't show any results.I think the touch event is not being detected by the code but even upon my several searching on net I have no clue what to do.Here is my code and any help would be appreciated
$(document).ready(function () {
$("#search").keyup(function (e){
var inp = String.fromCharCode(e.keyCode);
if (/[a-zA-Z0-9-_ ]/.test(inp)) {
$.ajax({
url: '/search.php',
type: 'POST',
data: "keyword=" + $(this).val(),
success: function (data) {
data = $.parseJSON(data);
if (data['response'] == true) {
$("#search_results").html(data['html']).show();
} else {
alert("Please try again.");
}
}
});
}
});
function hide_search_results(e) {
var container = $("#search_results");
if (!container.is(e.target) && container.has(e.target).length === 0) {
window.displayBoxIndex = -1;
container.hide();
}
}
$(document).mouseup(function (e) {
hide_search_results(e);
});
});