I need to receive a AJAX request value, but alway receive undefined.
Panda.Meals.getMealById = function(id) {
var meal = {};
$.ajax({
url: "http://localhost/admin.php?r=mess/getmealbyid",
data: {"id": id},
success: function(data) {
meal = data;
}
});
return meal;
}
var id = Panda.Meals.getMealById(10);