{"size": 1318, "ext": "js", "max_stars_repo_path": "js/suggest.js", "max_stars_repo_name": "Sushant/quest", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "js/suggest.js", "max_issues_repo_name": "Sushant/quest", "max_issues_repo_issues_event_min_datetime": "2021-03-19T21:48:45.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-25T21:38:42.000Z", "max_forks_repo_path": "js/suggest.js", "max_forks_repo_name": "Sushant/quest", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 30.6511627907, "max_line_length": 104, "alphanum_fraction": 0.4074355083}
    $(function() {
      $( "#searchText" ).autocomplete({
        source: function( request, response ) {
          $.ajax({
            url: "/suggest",
            dataType: "jsonp",
            data: {
              query: request.term
            },
            success: function( data ) {
              response( $.map( data.result, function( item ) {
                return {
                  label: item.name,
                  value: item.name,
                  desc: item.tag
                }
              }));
            }
          });
        },
        minLength: 2,
        select: function( event, ui ) {
          console.log('Selected');
          console.log(ui.item);
          if (ui.item) {
            $("#query").val(ui.item.label);
            $("#tag").val(ui.item.desc);
          }
         },
        open: function() {
          $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
        },
        close: function() {
          $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
        }
      })
      .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
        return $( "<li>" )
          .append( "<a>" + item.label + "<span style=\"float:right;color:#888\">" + item.desc + "</a>" )
          .appendTo( ul );
      };
    });
