1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MySQL, javascript...not sure how to do this.

Discussion in 'Programming' started by Crazy_Rob, Sep 13, 2005.

  1. #1
    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...
    SEMrush
    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 :D ).

    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? :confused:
     
    Crazy_Rob, Sep 13, 2005 IP
    T0PS3O likes this.
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    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?
     
    digitalpoint, Sep 13, 2005 IP
  3. Crazy_Rob

    Crazy_Rob I seen't it!

    Messages:
    13,155
    Likes Received:
    1,366
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, I guess that's what I need to know how to do though. Is this something I can do w/ MySQL 4.0.** ? :confused:

    Nope! Why, what are you getting at?
     
    Crazy_Rob, Sep 13, 2005 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,220
    Likes Received:
    778
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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?
     
    T0PS3O, Sep 13, 2005 IP
  5. Crazy_Rob

    Crazy_Rob I seen't it!

    Messages:
    13,155
    Likes Received:
    1,366
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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.
     
    Crazy_Rob, Sep 13, 2005 IP
  6. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #6
    There's a good tutorial on AJAX here, it really helped me to get started
     
    johnt, Sep 14, 2005 IP
  7. michele

    michele Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    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.
     
    michele, Sep 20, 2005 IP
  8. mikmik

    mikmik Guest

    Messages:
    356
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    0
    #8
    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)
     
    mikmik, Sep 30, 2005 IP
  9. dbtech

    dbtech Guest

    Messages:
    61
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    i doubt you can use js + database since js runs client side

    i can do this for you in php though
     
    dbtech, Oct 6, 2005 IP
    Crazy_Rob likes this.