I'm pulling information with ajax. I want it my document.ready function(ajax) starting first because knockout file starting first and my "var initialData" value going null. How my Ajax start first ?

[Here is my F12 Source](https://i.stack.imgur.com/2BHFS.png)

My script:

```
<script type="text/javascript">
        var initialData;
        function functionViewModel() {
                $(document).ready(function () {
                    $.ajax({
                        type: "POST",
                        url: "KnockoutGrid2.aspx/GonderUrunler",
                        data: "{}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (msg) {
                            console.log(msg.d);
                            initialData = msg.d;
                        }
                    });
                });
            var fn = {
                friends: ko.observableArray(initialData)
            };
            fn.removeUser = function (item) {
                fn.friends.remove(item);
            };
            return fn;
        };
        ko.applyBindings(functionViewModel());
    </script>

```