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.

Is it safe to update data in the database real time using AJAX? and is it ok to use the server for..

Discussion in 'JavaScript' started by LCpubs, Jun 9, 2015.

  1. #1
    Guys I need some help!
    In my app, for the shopping cart, I need to update the quantity values real time. Let's say someone set the quantity (but does not submit) and then close the browser. After a day or two he re-login and the updated qty should be there. For this im thinking of using $.getJSON to send the qty with the cart id and product id to the server so that the server can update them and send a response. Is this safe? (Im a bit new to JS and my app is on Rails)
    The other thing is, Im thinking of contacting the server and do the price calculations from there every time someone update the quantity and change the district. The reason is, in the server I use a special plugin called 'rails-money' which adds a special data type named money to handle currency calculations. Sometimes using float can be inaccurate.
     
    LCpubs, Jun 9, 2015 IP