search data

How to search data from database using jquery?

We need search criteria if we have thousands or more than that records in our database. In this situation we can select our respective data using search textbox.

Ex:

$(‘#txtSearch’).keyup(function(){

if ($(‘#txtSearch’).val().length > 1) {

$(‘#searchGridView tr’).hide();

$(‘#searchGridView tr:first’).show();

$(‘#searchGridView tr td:containsNoCase(\” + $(‘#txtSearch’).val() + ‘\’)’).parent().show(); 

}

else if ($(‘#txtSearch’).val().length == 0) { 

resetSearchValue(); 

}

})

Explanation:

In this example we are taking the id of textbox and on its keyup event we are calling database to seach a respective text in database.