Loading...
 
Skip to main content

History: API Tracker Update Demo

Preview of version: 1




CODE(colors="javascript")}$(".stockAdmin.minus, .stockAdmin.plus")
.css("cursor", "pointer")
.on(
"click",
function () {
let itemId = location.href.match(/product-(\d+)/);
if (itemId) {
itemId = itemId1;
} 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;
})
{CODE}

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