This is example of searching users JSON data based on user's input and showing them user in clean way. Click here to know how text box with reset button (Clear field) works


Find below Users info in JSON format
var userData = [
            {"id":"1", "name":"Srinivas Dasari", "place":"Chennai", "pic":""},
            {"id":"2", "name":"Srinivas Tamada", "place":"Atlanta", "pic":""},
            {"id":"3", "name":"Sri Harsha", "place":"Hyderabad", "pic":""},
            {"id":"4", "name":"Lokesh Raghuram", "place":"Chennai", "pic":""},
            {"id":"5", "name":"Bala Ganesh", "place":"Chennai", "pic":""},
            {"id":"6", "name":"Arun kumar", "place":"Chennai", "pic":""}


<!-- Search text box with clear field -->
 <div class="slinput">
    <i class="fa fa-search left-icon"></i> 
    <input id="searchInput" onkeyup="searchUsers()" placeholder="Search here" /> 
    <i class="fa fa-close right-icon"></i>
 <!-- Users information will be in this div -->
 <div id="users">

jQuery Code

// user's input for search
var searchVal = '';

      // if text box value is not null, then darken reset icon
      $(".slinput input").keyup(function(){
        var val = $(this).val();   
        if(val.length > 0) {
        } else {
      // if user click on reset icon, clear text field
      $(".slinput .right-icon").click(function(){

// Displaying Information to Users
function loadData(data) {
    var htmlData = '';
    $.each(data, function(index, val){
        htmlData += '<div class="media user">'+
        '  <div class="media-left">'+
        '    <a href="#">'+
        '      <img class="media-object" src="'+val.pic+'" alt="...">'+
        '    </a>'+
        '  </div>'+
        '  <div class="media-body">'+
        '    <h4 class="media-heading">''</h4>'+
        '    '
        '  </div>'+

// Search users data based input search keyword
function searchUsers() {
    var val = $("#searchInput").val();
    if(val == searchVal) {
    } else {
        searchVal = val;
        var searchResults = {};
        searchResults = [];
        $.each(userData, function(i, v) {
            if ( != -1) {


  1. very good example thanks Srinivas

  2. I have just submitted my essay through turnitin it was 31% and after excluding the references it was 0% of similarity. I am very pleased with help me write my paper for free so far the writer done the essay in a short time of a notice all i am hoping for now to get a distinction.

  3. For good reason, not all data is openly available. Before you can ask how I can access API data, you must first ask how I may be allowed entry to it. Many sites that store valuable information, such as Facebook or Instagram's APIs, will want to know who and what you are before willingly giving you their data. Fortunately, many websites don't care and openly provide JSON data, so we won't need to have a key today. You can also visit the link below to see more updates.



Popular Posts