Bootstrap-3-Typeahead icon indicating copy to clipboard operation
Bootstrap-3-Typeahead copied to clipboard

how display no result found

Open iman-lh opened this issue 8 years ago • 1 comments

if the user write a wrong word , we must displayed "no result found"

iman-lh avatar Oct 19 '17 14:10 iman-lh

It is better if you have any code for me to look at because I'm using ajax in the source part, yours might differ but anyway here's my solution. If you have any question in stackoverflow let me know, I want to gain some reputation :)

$('#inputName').typeahead({
	source: function (query,process) {
		$.ajax({
			url: 'action.php',
			data: {'key':'',q: query},
			dataType: 'json'
		}).done(function(data) {
			if(data.length<=0){
				// Display no result found
			}
			return process(data); // <-- Do not ever try to put this at the 'else' statement, your hint box will be stucked
		});
	}
});

iztan avatar Nov 19 '17 17:11 iztan