Witajcie mam funkcję w której wszystko szło pięknie do momentu wywołania ostatniego skryptu ajaxem -.- jakieś sugeste? chodzi o linijkę nr 21
function buy(id) {
$.post("game/queries/player.php", function (player_info) {
var player = jQuery.parseJSON(player_info);
$.post("game/queries/userstats.php", function (user_info) {
var user = jQuery.parseJSON(user_info);
$.post("game/queries/item.php?id=" + id, function (item_info) {
var item = jQuery.parseJSON(item_info);
var divs = '<div class="msg_js" onclick="my_remove(\'msg_js\')">';
var dive = '</div>';
var msg;
msg='Wystąpił błąd spróbuj jeszcze raz';
if(player.class == item.allow_character1
|| player.class == item.allow_character2
|| player.class == item.allow_character3
|| item.allow_character1 == 0
|| item.allow_character2 == 0
|| item.allow_character3 == 0
) {
if (user.lvl >= item.allow_lvl) {
if (user.gold >= item.cost_gold) {
$.post("game/queries/buyitem.php?id=" + item.ID_item, function (data_info) {
msg =data_info;
});
} else {
var want_gold = item.cost_gold - user.gold;
msg = 'Nie stać Cię na zakup<br/>' + item.item_name + '<br/>Brakuje Ci ' + want_gold + ' złota';
}
} else {
msg = 'Aby kupić ten przedmiot musisz zdobyć ' + item.allow_lvl + ' poziom';
}
} else {
msg = 'Ten przedmiot nie jest przeznaczony dla twojej klasy postaci';
}
$(divs + msg + dive).appendTo($(".max_width"));
setTimeout(function () {
$('.msg_js').fadeOut(1000, function () {
this.remove();
});
}, 1500);
});
});
});
}