lundi 15 décembre 2014

Return a value

I use function.


HTML Code:



function getUnical(id, type) {
//var data = {};
var res = false;
Ext.Ajax.request({
url: 'inc/ajax/staff_edit.php?v='+type,
method: 'POST',
params: {
id: id
},
success: function(response){
//console.log(response);
var obj = Ext.decode(response.responseText);
//console.log(obj);
if (obj.success == 'error')
{
var staff = obj.staff;
Ext.getCmp(type).focus();
//console.log(staff);
res = staff;
}
}
});

return res;
}

After the query it must return a value. But for some reason always returns false.Why? How to return the "staff" value?



Return a value

Aucun commentaire:

Enregistrer un commentaire