     # Get resource URIs and run app
     # Todo: error handling
     $.ajax API_ROOT,
+        dataType: 'json'
+        beforeSend: (r) => r.setRequestHeader 'Accept-Version', ACCEPT_VERSION
         success: (r) =>
+            if r.status != 'ok'
+                $('#loading').append $('<div class="modal-error"><p class="alert alert-error"><strong>Error:</strong> Unexpected response from server</p></div>')
+                return
             app.uris =
                 root: API_ROOT
                 samples: r.samples_uri


# Root endpoint of Varda server
API_ROOT = '/'


# Create HTTP Basic Authentication header value

            app.run()
            $('#aule').show()
            $('#loading').fadeOut 'fast'
        error: =>
            $('#loading').append $('<div class="modal-error"><p class="alert alert-error"><strong>Error:</strong> Could not connect to server</p></div>')
