Javascript-форум (https://javascript.ru/forum/)
-   Events/DOM/Window (https://javascript.ru/forum/events/)
-   -   Помогите сделать инкриментный поиск на сайте (https://javascript.ru/forum/events/16464-pomogite-sdelat-inkrimentnyjj-poisk-na-sajjte.html)

betonka 09.04.2011 13:05

Помогите сделать инкриментный поиск на сайте
 
Нашел ui.jquery http://jqueryui.com/demos/autocomplete/#categories
который мне нравится но не могу понять как подключить JSON, подскажите пожалуйста советом? и если есть возможность примером

$.widget( "custom.catcomplete", $.ui.autocomplete, {
		_renderMenu: function( ul, items ) {
			var self = this,
				currentCategory = "";
			$.each( items, function( index, item ) {
				if ( item.category != currentCategory ) {
					ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
					currentCategory = item.category;
				}
				self._renderItem( ul, item );
			});
		}
	});

	$(function() {
		var data = [
			{ label: "anders", category: "" },
			{ label: "andreas", category: "" },
			{ label: "antal", category: "" },
			{ label: "annhhx10", category: "Products" },
			{ label: "annk K12", category: "Products" },
			{ label: "annttop C13", category: "Products" },
			{ label: "anders andersson", category: "People" },
			{ label: "andreas andersson", category: "People" },
			{ label: "andreas johnson", category: "People" }
		];
		
		$( "#search" ).catcomplete({
			delay: 0,
			source: data
		});
	});


что бы я мог подключить файл с которого брались даные


Часовой пояс GMT +3, время: 13:19.