Forum Moderators: open

Message Too Old, No Replies

Moving Data to the Client?

Need to load listboxes on the fly...

         

RossWal

5:08 pm on Sep 11, 2002 (gmt 0)

10+ Year Member



I'm trying to solve a problem and wonder if others can share similar experiences. I have a set of three selection boxes that hold data from a SQL database. The data in the select boxes are related such that what is selected from box1 determines what is available in box2, and selelctions from box2 determine what goes into box3.

Since I don't want to bang against the server after each box selection, I have loaded the data into a multi-dimentional javascript array that gets sent to the client embedded in the html file. Since there is the potential for a fair amount of data, I've placed indices in the value elements of the select boxes to help find the correct place in the javascript array to begin loading the next box. So far so good.

Now I'm thinking about client side caching of the javascipt. I've considered a couple options, each of which involves moving the javascript array to a new file. One possibility is to use the file system object to write a new version of the javascript file whenever a change is made to the underlying SQL data (1-2 times per week). The other thought is to actually make the javascript file a .asp extension file and build it on the fly. I've got some thoughts on how to expire and trigger a refresh, but without going into them I'm wondering if someone hasn't already invented a better version of this mousetrap?

Thanks for your interest,
Ross

txbakers

6:46 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's a great challenge and my solution thus far was to bang against the server again. I'd love to see if yours works and I'll ping at it while myself. I'd like to avoid the double trip to the server as well.

RossWal

8:19 pm on Sep 11, 2002 (gmt 0)

10+ Year Member



tx,
As I say, It's working OK now. The problem will be when the volume of data reaches the point that it's unreasonable to send the javascript instream with the HTML. I could post some code if that would be helpful.

aspdaddy

10:07 pm on Sep 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem will be when ..

If this is gonna happen, I'd be looking at worst case scenario and doing that now, with test data in the db.

Just a crazy idea i had! - You could flush the buffer after the main page elements are on it, and placing some hidden data below the closing </body> tag, the page might look fully loaded, before it really is?

RossWal

10:23 pm on Sep 11, 2002 (gmt 0)

10+ Year Member



Well that's an interesting thought that I let flit in and out of my head yesterday. I guess I would want to disable the dynamic boxes until the the body onload event to prevent raising onchange events that could fail without the supporting javascript data. That was the reason I let it flit out yesterday, I was afraid of the possible runtime errors, but the disable solves that. I dunno whether an onchange event can fire while the page is still loading or not?

Thanks for the thought!