Skip to content

Instantly share code, notes, and snippets.

@vvikramjhu
Last active August 29, 2015 13:55
Show Gist options
  • Save vvikramjhu/8702800 to your computer and use it in GitHub Desktop.
Save vvikramjhu/8702800 to your computer and use it in GitHub Desktop.
function bind_auto_complete_new(){
$('.auto_complete_cve').on('keyup.autocomplete', function(){
search_field_id = $(this).prev().val();
$(this).autocomplete({
source: function(request, response) {
$.get('cve_auto_complete_data_new.php', { type_id: search_field_id, search_term: request.term }, function(data) {
response(data.split('\n'));
});
},
delay: 250,
minLength: 3
});
});
}
function add_search_field( html_form_id, select_options) {
$(get_search_fields( select_options )).prependTo(html_form_id);
};
function get_search_fields( select_options ){
return "<div><select name='property_name[]'>" + select_options + "</select> <input type='text' name='search_text[]' class='auto_complete_cve'></div>";
}
[{"vendors":["Microsoft (199)","Supermicro (134)","Trianglemicroworks (73)","Michael Vogt (3)","Erik Michaels-ober (1)","Michael Staatz (1)"]},{"products":["Micom S1 Studio (2)","Micom S1 Agile (1)"]}]
$public_names_array = get_public_name_from_table($type_id, $term, $mysqli);
//$public_names_array = get_public_names($table_id, $term, $mysqli);
$public_names_array = flatten($public_names_array);
//var_dump($public_names_array);
echo implode("\n", $public_names_array );
Microsoft (199)
Supermicro (134)
Trianglemicroworks (73)
Michael Vogt (3)
Erik Michaels-ober (1)
Michael Staatz (1)
Microsoft (199)
Supermicro (134)
Trianglemicroworks (73)
Michael Vogt (3)
Erik Michaels-ober (1)
Michael Staatz (1)
Micom S1 Studio (2)
Micom S1 Studio (1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment