migrated to api2
This commit is contained in:
parent
a3223e197c
commit
9729e675ff
|
@ -5,20 +5,20 @@ jQuery(document).ready(function($) {
|
|||
var lock = false;
|
||||
var items = [false];
|
||||
|
||||
$.getJSON('/api/store/', function(data) {
|
||||
$.getJSON("/api2/buyable/item", function(data) {
|
||||
if(data.error === undefined) {
|
||||
source = [];
|
||||
|
||||
$.each(data, function(key, val) {
|
||||
items[val.pk] = val;
|
||||
$.each(data, function(key, item) {
|
||||
items[item.id] = item;
|
||||
|
||||
source.push({
|
||||
value: val.pk,
|
||||
label: "<span class='preview pk" + val.pk + "'><img src='" +
|
||||
MEDIA_URL + val.fields.image + "' alt='" +
|
||||
val.fields.name + "' /></span>" +
|
||||
"<span class='meta'>" + val.fields.name +
|
||||
"<br />Preis: " + val.fields.price.toFixed(2) +
|
||||
value: item.id,
|
||||
label: "<span class='preview pk" + item.id + "'><img src='" +
|
||||
MEDIA_URL + item.image + "' alt='" +
|
||||
item.name + "' /></span>" +
|
||||
"<span class='meta'>" + item.name +
|
||||
"<br />Preis: " + parseFloat(item.price).toFixed(2) +
|
||||
" €</span><span class='buy'></span>"
|
||||
});
|
||||
});
|
||||
|
@ -58,8 +58,8 @@ jQuery(document).ready(function($) {
|
|||
if(lock && event.keyCode === 39) {
|
||||
selected_item.addClass("load");
|
||||
|
||||
$.get("/api/store/buy/" + selection.value + "/", {
|
||||
|
||||
$.post("/api2/buyable/item/" + selection.value, {
|
||||
"deposit": "1"
|
||||
}, function(data, status) {
|
||||
selected_item.removeClass("load");
|
||||
|
||||
|
|
Loading…
Reference in New Issue