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:
>
>
>
> > Hello, i have just joined this group. First Google group i join !
> > I'm not native English speaking so sorry if i make some grammar
> > mistakes.
>
> > Anyway, the past 2 weeks i've been looking into JSON/AJAX functions of
> > jquery.
> > Now the reason for me doing that is that I want to make the following:
>
> > I want to have an input field that ask you for a code, let's say
> > "abc", my script should then automatically search for the price in the
> > database, so with an onblur i suppose.
>
> > Now i googled/read etc etc, and i came up with a script that worked.
> > It ran a PHP script, generated an array according to the SJON standard
> > that i found on the official website.
>
> > BUT after re-thinking  what I was doing i thought to myself "what if I
> > have a database with 10 000 products. I would load a query each time
> > to search trough these 10 000 products/items.  So I figured there must
> > be a better way. So i came up with the following idea:
>
> > lets run the PHP scripts one's a day and generate a .JS file
> > containing ALL the products in some sort of array readable for
> > $.getJson(). And this is where I get stuck:
> > how can I read trough the JS file and only select the price of the
> > item of witch I typed in the code "abc" ?
>
> > so if I have products.JS generated by PHP-script containing :
> > {"channel":{"items":[{"id":"1","prijs":"10","naam":"a"},
> > {"id":"2","prijs":"5","naam":"b"},
> > {"id":"3","prijs":"22","naam":"c"}]}}
>
> > how could I select the "prijs" of product "a" from that JS-file ? Is
> > it at all possible and if so how ?
>
> > Help would be greatly appreciated !

Reply via email to