Как я могу установить переменную "price" после вызова ajax?
вот код:
var price;
var idProd = data.prodotto_id;
var cb = function (o,s,r){
price = Ext.util.JSON.decode(r.responseText).price;
console.log(price);
};
Ext.Ajax.request({
url : "index.php",
params : {
m : "Prodotti",
a : 'prod-price-byquantity',
idProd : idProd,
quantity: qta
},
callback : cb,
scope : this
});
console.log(price);
В последнем файле console.log (цена) я вижу цену как неопределенную