Skip to content

Instantly share code, notes, and snippets.

@vvikramjhu
Last active August 29, 2015 13:56
Show Gist options
  • Save vvikramjhu/9026428 to your computer and use it in GitHub Desktop.
Save vvikramjhu/9026428 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
if (!("autofocus" in document.createElement("input"))) {
if($("#login_form_text")){
$("#login_form_text").focus();
}
};
/* This Functions works as well as the one below
* $('.auto_complete_cve').customMenuComplete({
source:
function(request, response) {
search_field_id = $(this).prev().val();
$.get('cve_auto_complete_data_new.php', { type_id: search_field_id, search_term: request.term }, function(data) {
response( $.map( data, function( item ) {
return {
type:item.type,
label: item.label,
value : item.value
}
}));
},"json");
},
delay: 100,
minLength: 1
});
*/
$('#cve_search').on('submit', function(e){
// Tell browswer not to submit default action
e.preventDefault();
$.ajax({
url: 'search_indexPage.php',
type: 'GET',
dataType: 'json',
data: $('#cve_search').serialize()
}).done(function(data){
response($.map(data, function(item){
console.log(item);
}));
});
});
$("#add_more_search").click(function() {
add_search_field("#cve_search", get_search_options());
bindAutocomplete();
});
});
//Resulturl I get : http://localhost/?property_name%5B%5D=-1&search_text%5B%5D=+Microsoft+%28vendor%29 . why no url ?
<form name="cve_search" id="cve_search" action="">
<input type="submit" id="search_button" value="Search">
</form>
Generated markup
<div id="landing_page_search">
<input id="add_more_search" type="button" name="add_more_search" value="Add Another Field">
<form id="cve_search" action="" name="cve_search">
<div>
<select name="property_name[]">
<input class="auto_complete_cve ui-autocomplete-input" type="text" onclick="toggleHeight(this , 300);return false" name="search_text[]" style="width:300px" autocomplete="off">
<span class="ui-helper-hidden-accessible" role="status" aria-live="polite"></span>
</div>
<input id="search_button" type="submit" value="Search">
</form>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment