Here is my codes,
function getMods(name){
    var init;
    $.ajax({
    type: "POST",
    url: "init.php",
    data: { 'id': getID(), 'Name': name },
    cache: false,
    success: function(data)
        {
            return data;
        },
        async:false
    });
}
function init(){
    var gm = '<br/>';
    var gm1 = getMods('Name');
        $('#brand').append(gm1);
    var gm2 = getMods('Owner');
    var gm3 = getMods('Admin1');
    var gm4 = getMods('Admin2');
    var gm5 = getMods('Admin3');
    var gm6 = getMods('Admin4');
    $('#online3').append(gm2 + gm + gm3 + gm + gm4 + gm + gm5 + gm + gm6 + gm);
}
The getMods() returned "undefined". When i use this code:
alert(data);
The page alerted the correct values.
Here is the php file init.php:
<?php
include('dbconnect.php');
if(isset($_POST['id']) && isset($_POST['Name'])){
$id = $_POST['id'];
$name = $_POST['Name'];
$init = chatMods($name,$id,$username,$password);
echo $init;
}
?>
And I add the async in the getMods().
 
     
    