Well, I posted this here a few months ago but got no replies. But I really need to start working on this now or hire someone to do it for me. Anyway... Basically my company has an extremely complex Cobol freight calculation program. It gives us a competitive advantage becuase we can immediately give the customer the exact amount UPS will charge us. Printed out it's hundreds of pages. Right now our ecommerce site doesn't quote freight amounts. And obviously this hurts sales a little (although we still get 50+ orders per day online ). Basically the Cobol program will read the remote MySQL table, calculate the freight based on a number of factors (items, weight, size, packaging, # of parcels, zip code, service, etc...). My question: How can I tell when the table has been updated w/ the freight amount? It may take a few seconds and I've looked at using MySQL triggers but I have no experience w/ them. So I figured this would probably be something I could use js for. I just need it to check the table every second to see if there's a value. Any ideas?
You probably will need to setup something to poll it in a loop. There isn't really a good way to have the backend notify the client of something. Is there a reason the process has to be running in an isolated thread?
Yeah, I guess that's what I need to know how to do though. Is this something I can do w/ MySQL 4.0.** ? Nope! Why, what are you getting at?
How about using AJAX? No too familiar with it yet but it sounds like it could help you out there. I'd imagine the punter fills out their zipcode and lands on the next page which first processes the cart+zipcode+other vars and starts calculating the fee as well as storing it. But you don't know yet it was actually stored because it's running in the background, that's the problem here right? You could default the 'continue' button to the same page. Have a table around this button which triggers the httpxmlrequest event on mouseover. If before they reach and click the button it finds the necessary fields it could update the button code to actually continue. If the thread hadn't finished yet it won;t be able to update the button in time so clicking continue will put them back where they were (ugly in a way but at least you can show something like - still calculating your shipping fees - or something). Is the calculation that complex that it takes so long you don't want to load the result in the same page?
Nice, I didn't think of that. I'll check it out! Right! Yeah, that's pretty much what I had in mind. Thanks! It's very complex but wont take more than a few seconds. I'll still most likely have to do a ":::::::calculating shipping rates:::::::" type message. Thanks, this gives me something to go on. I've never done anything like this before so I'm having a tough time getting started.
I don't know a lot about AJAX yet, but I've seen it in action and it is cool. What it appears to do is regularly update just a small part of a webpage, say a number or a string, without the overhead and traffic required to continually reload an entire page.
I followed a tute 4 month bach and made exactly what you want. It got data from server, it was searcheable, and the table columns were re-arrangeable by clicking on them. Then, it didn't work in FF, and I cried! Oh how I cried LMAO! I think we can do this with a slightly differeny http request object that Mozilla undewrstands! I am trying to find the tutroial, but there are tons. The hard part for me would be converting the data, but I know xslt (that wouldn't be necessary unless we were really, really doing something wrong)