migrated to api2

This commit is contained in:
Konrad Mohrfeldt 2011-10-12 21:13:21 +02:00
parent a3223e197c
commit 9729e675ff
1 changed files with 12 additions and 12 deletions

View File

@ -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");