Fill an Array in js file [duplicate]

i use this code to fill reviewArray, but it’s not getting filled in the right position.

getSuccessOutput();
function getSuccessOutput() {
    $.ajax({
        type: "post",
        url: 'RetMetriseis.php',
        dataType: "json",
        success: function (data) { //start success            
            var oldString = JSON.stringify(data);
            var laststring;            
            oldString = oldString.replace('{"result":', "");
            laststring = oldString.slice(0, oldString.length - 1);
            console.log(laststring);
            this.searchData = JSON.parse(laststring);
            console.log(searchData);
            reviewArray=( JSON.parse(laststring));
            console.log(reviewArray);

            comboBoxObject.datasource = reviewArray;
            comboBoxObject.dataBind();
            return;
        },
        error: function () {
            alert('There was some error performing the AJAX call!');
        }
    });
    //return false;
}
let comboBoxObject = new ej.dropdowns.ComboBox({
    // bind the country data to dataSource property

    dataSource: reviewArray,
    // maps the appropriate column to fields property
    fields: {
        text: "ptype",
        value: "id"
    },
    //set the placeholder to ComboBox input
    placeholder: "Select something",
    //enable the autofill property to fill a first matched value in input when press a down key
    autofill: true
});
comboBoxObject.appendTo('#comboelement');

i need reviewArray to fill comboBoxObject but getSuccessOutput() function runs lastly!
Any suggestion?