: $.post() Ajax. , $.post() , , alert(). , Ajax , $.post(), , , alert() , .
: this , , jQuery , , , , UserMenu . - this , retrieve(), :
var UsersMenu = function(){
this.returnUsers = [];
this.retrieve = function(posts){
var self = this,
temp = [];
$.post("router.php", { "action": "getUsersMenu", "posts" : posts},
function(data)
{
if(data.response){
for(var i=0; i<data.returnUsers.length; i++){
temp.push(data.returnUsers[i]);
}
self.returnUsers = temp;
}
}, "json");
alert(this.returnUsers);
}
}
, retrieve() Ajax, JavaScript , .