JQuery Auto complete plugin
http://jqueryui.com/autocomplete/
Html->script('jquery-ui'); ?>
Html->css('jquery-ui'); ?>
//$('#tags').keypress(function(){ // when clicked sign in button ajax call performs
var availableTags1;
$(function() {
$.ajax({
type : "POST",
//data : $('#UserAjaxloginForm').serialize(),
//url : 'http://localhost/autosuggest/autosuggest1.php',
url : myBaseUrl+('/home/autoComplete'),
//url : "/dealzbuyp4sep15/index.php/users/ajaxlogin?un="+(($('#UserUsername').val())),
success : function(opt){
av = new String(opt)
availableTags1 = av.split(',');
//alert(availableTags1);
$( "#LocationmasterName" ).autocomplete({
source: availableTags1
});
}
});
});
function searchValidate()
{
$('#LocationmasterName').html('');$('#SubcatName').html('');
if(($('#LocationmasterName').val() == '' || $('#LocationmasterName').val() == 'Local search...' || $('#LocationmasterName').val() == 'No results found' ) && ($('#SubcatName').val() == '' || $('#SubcatName').val() == 'I am Looking For...' || $('#SubcatName').val() == 'No results found' ) )
{
$('#LocationmasterNameMsg').attr('value', 'No results found');
$('#SubcatName').attr('value', 'No results found');
return false;
}
else
{
return true;
}
}
$(document).ready(function(){
$("#SubcatName").focusout(function() {
var searchword = $( "#SubcatName" ).val();
if((jQuery.inArray(searchword, availableTags2) < 0) && $( "#SubcatName" ).val() != '')
{
$('#SubcatName').attr('value', 'No results found');
}
});
});
$(document).ready(function(){
$("#LocationmasterName").focusout(function() {
var locationsearchword = $( "#LocationmasterName" ).val();
if((jQuery.inArray(locationsearchword , availableTags1) < 0) && $( "#LocationmasterName" ).val() != '')
{
$('#LocationmasterName').attr('value', 'No results found');
}
});
});
Html form
Form->input('place',array('label' => '','id' => 'LocationmasterName', 'title' => 'Local search...')); ?>
0 comments:
Post a Comment