Loading...
 
Skip to main content

History: API Tracker Update Demo

Preview of version: 4


Try this API Tracker Update Demo?itemId=2745



Copy to clipboard
$(".stockAdmin.minus, .stockAdmin.plus") .css("cursor", "pointer") .on( "click", function () { let itemId = location.href.match(/itemId=(\d+)/); if (itemId) { itemId = itemId[1]; } else { alert("No product id found"); return; } const $stockAdmin = $(".stockAdmin.number"); $stockAdmin.tikiModal(" "); let stock = $stockAdmin.text(); if ($(this).hasClass("minus")) { stock--; } else { stock++; } $.ajax( $.service("tracker", "update_item"), { type: 'POST', dataType: 'json', data: { fields: { productsStock: stock }, itemId: itemId, trackerId: 1 }, success: function (data) { if (!data) { alert("Oops, something went wrong, sorry"); } else { $stockAdmin.text(stock); } $(".stockAdmin.number").tikiModal(); } } ); return false; })

History

Advanced
Information Version
Jonny Bradley 9
Jonny Bradley 8
Jonny Bradley 7
Jonny Bradley 6
Jonny Bradley 5
Jonny Bradley 4
Jonny Bradley 3
Jonny Bradley 2
Jonny Bradley Not finished yet... 1