[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-25 Thread Thomas Jaggi
Well, it looks like indexOf() (or probably better search()) is ok since I just have to check a string for another one (e.g. is "2008" contained in the date value).

[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-22 Thread Thomas Jaggi
(I didn't write the filter stuff yet...)

[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-22 Thread Thomas Jaggi
Hi Nicolas, I will definitely look into this, thank yout! On 22 Feb., 13:34, Nicolas R wrote: > Hey Thomas, > from what you're saying it seems that we're trying to tackle the same > issue. Have a look at this it may be > helpful:http://groups.google.com/group/comp.lang.javascript/browse_threa

[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-22 Thread Nicolas R
Hey Thomas, from what you're saying it seems that we're trying to tackle the same issue. Have a look at this it may be helpful: http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/83281987eccf68be What's your solution? On Feb 21, 4:24 pm, Thomas Jaggi wrote: > Great, that's

[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-21 Thread Thomas Jaggi
Great, that's it. Thanks a lot! The indexOf is just an example. The options are actually some kind of filters and I want to check each item against each filter. Depending on the filter It could be indexOf. On 21 Feb., 14:44, Mike wrote: > > What is "key"?  That's not in either one of your dat

[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-21 Thread Mike
> What is "key"?  That's not in either one of your data structs. Oops, sorry, didn't look closely enough. But you can't use 'key' that way. Try this: if (item[key].indexOf(options[key]) != -1) Not sure what you're after with the indexOf though.

[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-21 Thread Mike
> This doesn't work: > $.getJSON("wheremydatais", function(data){ >         $.each(data.items, function(i,item){ >                 $.each(options, function(key,val){ >                         if (item.key.indexOf(options.key) != -1) { >                                 console.log('everything ok');

[jQuery] Re: Loop through JSON data and check for each option specified

2009-02-21 Thread Thomas Jaggi
Sorry, I mean "if (item.key.indexOf(val) != -1) {". But anyway, any ideas? I know my approach probably makes no sense at all...