Why not just do this:
$.get("page_name",input,function(data){
$("li").removeClass("wanted").removeClass("notwanted");
for (i in data) {
$("#"+data[i]).addClass("wanted");
}
$("li").not(".wanted").addClass("notwanted");
});
- jake
On 2/15/07, Dominik Hahn <[EMAIL PROTECTED]> wrote:
> My current code looks like this:
>
> function filter(query) {
> if(query != '') {
> $("li").each(function(i){
>
> $(this).removeClass('wanted').addClass('unwanted');
> });
> $.getJSON("$homeadress/suche.php",
> { do: "ajax", type: 'filter', what: 'all', query: query },
> function(data){
>
> for ( keyVar in data ) {
> var id = '#'+data[keyVar];
>
> $(id).addClass('wanted').removeClass('unwanted');
> }
>
> $('li').not('.wanted').addClass('unwanted');
>
> }
> );
> }
> else {
> // no real search
> $("li").each(function(i){
>
> $(this).removeClass('wanted').removeClass('unwanted');
> });
> }
> }
>
>
> Any thoughts on this? :-)
>
>
> dominik
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/