jQuery UI Sortable, how to update MySQL table on event?

72
February 25, 2018, at 12:41 PM

Using jQuery UI Sortable, i have some variables on stop event. How to update MySQL table with this variables on this event?

    stop: function(){           
        var rc3_$item_id = $('#rest_$item_id').find('li').length - 1
        var oc3_$item_id = $('#ord_$item_id').find('li').length - 1
        var sc3_$item_id = $('#sold_$item_id').find('li').length - 1
    }

What i need is be like:

UPDATE lot_items SET item_qnty_rest = rc3_$item_id, item_qnty_ord = oc3_$item_id, item_qnty_sold = sc3_$item_id WHERE item_id = '{$item_id}'

$item_id in all cases is php variable, which page get on load.

I was trying to read about AJAX, but don't get it. Maybe, must do this:

stop: function(){
        var rc3_$item_id = $('#rest_$item_id').find('li').length - 1
        var oc3_$item_id = $('#ord_$item_id').find('li').length - 1
        var sc3_$item_id = $('#sold_$item_id').find('li').length - 1
        $.ajax({
            type: "POST",
            data: { 
                item-id: $item_id,
                rest: rc3_$item_id, 
                ord: oc3_$item_id,
                sold: sc3_$item_id
            },
            url: "components/journal/journal_update.php",
        });
    }

If that right, what must be in a file journal_update.php, to update MySQL table?

READ ALSO
How to remove special characters and codes (using jquery) from sharepoint rendered html?

How to remove special characters and codes (using jquery) from sharepoint rendered html?

I am Working on a branding of share-point applicationIn some cases, rendered html contains codes like '​'

72
Optimize website and third party scripts AWS

Optimize website and third party scripts AWS

We have below third party scripts running on the website

80
How to set proper Timer per container, with a global loop?

How to set proper Timer per container, with a global loop?

sorry if this posted in the wrong place, I'm not sure if what I'm trying to do is associated with HTML or CSS, so if anyone has any insight for a newbie like me, it would be much appreciated!

37
Add class to previous element

Add class to previous element

I just want to add class for the button after another class but it's inside of another divTake a look at this example

72