In a html document I am using this snippet trieing to get a json from a URL.

```
<script type="text/javascript">            
        $.ajax({
            type: 'GET',
            url: 'http://rest-service.guides.spring.io/greeting',
            dataType: 'json',
            success: function (data) {
                document.write(data)
            }
        });
    </script>

```

With document.write(data) I want to display it on my html output in browser. But it only displays "Test". What am I doing wrong here?`

Full html document:

```
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ServiceNow Extension</title>
    <script src="sdk/scripts/VSS.SDK.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
    <script type="text/javascript">VSS.init();</script>
    <h1>Test</h1>
    <script type="text/javascript">VSS.notifyLoadSucceeded();</script>

    <script type="text/javascript">           
        $.ajax({
            type: 'GET',
            url: 'http://rest-service.guides.spring.io/greeting',
            dataType: 'json',
            success: function (data) {
                document.write(data)
            }
        });
    </script>

</body>
</html>

```