Store a rendered value in db

Store a rendered value in db

andreavelloneandreavellone Posts: 46Questions: 13Answers: 2

Hi,
i have a calculated value. Everytime i load the table with a function I calculate a value.
So i need this value also for other issue.
How i can, everytime i load the page update the calculated value in the db?
Tx a lot for your suggestions

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,985Questions: 87Answers: 421
    Answer ✓

    https://datatables.net/reference/event/

    use an event "init" or "draw" or whatever event is suitable for your purposes and do an ajax call to the server in order to make the database update on the server:

    Here is an example:

    yourTable
      .on ('init', function () {
               $.ajax({
                        type: "POST",
                        url: 'actions.php?action=yourAction',
                        data: {
                            yourCalculatedValue: yourCalculatedValue
                        },        
                        success: function () {
                            yourTable.ajax.reload();
                        }
                    });
            } )
    
  • andreavelloneandreavellone Posts: 46Questions: 13Answers: 2

    tx a lot

This discussion has been closed.