function aj_proc(){ var result; $.ajax({ type: "POST", dataType: 'json', url: "/functions_ajax/get_walls", data: {id:id,model:model}, success: function(data){ var result = data } }); return (result); }