djake1680
8/21/2018 - 6:10 PM

JavaScript fetch using formData

JavaScript fetch using formData

var formData = new FormData();
formData.append('cost', cost);
formData.append('id', id);
fetch('stock_log/update_purchase_price', {
    method: 'POST',
    body: formData
})
    .then(function(response) {
        let result = response.json();
        result.then(function (res) {
            console.log(res);
        })
    });