|
you can search the json array with $.each var nameWanted = "a"; var data=""> {"id":"2","prijs":"5","naam":"b"}, {"id":"3","prijs":"22","naam":"c"}]}} $.each(data.channel.items,function(i,item) { if (data.channel.items[i].naam == nameWanted) { index=i; prijsWanted= data.channel.items[i].prijs; alert(prijsWanted); } }); Kristof wrote: i like the idea of building in a treager. each time the user ads a new product or changes a product i could rewrite the new file. Good idea thanks! thanks for the URL"s too !On Jun 2, 8:02 pm, jsuggs <[email protected]> wrote:Look at some of the auto-complete plugins, they do a lot of what you are asking for already including caching of results so that you don't have to do as many lookups or requests. http://plugins.jquery.com/project/autocompletexhttp://plugins.jquery.com/project/js-autocompletehttp://plugins.jquery.com/project/ajax-autocomplete And yes, having a process run daily to generate the values can be a good idea if you don't need up-to-date values. One other method is to have a "trigger" run every time that a new value is added. That way, when the first item is added the file will be created with just the single item. You wouldn't have to hit the database again until another item was added and the file overwritten. Both methods are pretty common practice, but don't overestimate the cost of doing a live database lookup, if you have an index on the column that you are searching through then its impact should be fairly minimal (thus eliminating the need for a more complex solution). On Jun 2, 4:03 am, Kristof <[email protected]> wrote: |
- [jQuery] JSON- PHP generated JS-file question Kristof
- [jQuery] Re: JSON- PHP generated JS-file question jsuggs
- [jQuery] Re: JSON- PHP generated JS-file question Kristof
- [jQuery] Re: JSON- PHP generated JS-file question Charlie
- [jQuery] Re: JSON- PHP generated JS-file question James

