{dialog.object}serverIsAvailable Method


{dialog.object}.serverIsAvailable( [timeOut [, successFunction [, errorFunction]]);



If you don't specify a timeOut, the default value is 300 milliseconds.


The 'successFunction' parameter allows you to pass in an Javascript function to be called once it is determined that the Alpha Anywhere server is available.


The 'errorFunction' parameter is called if the server is not available.


Tests if the Alpha Anywhere server is available. This is a more comprehensive test than simply testing if an Internet connection is available.

Contrast this method with the UX component's ._getOnlineStatus() method. This method merely tests if there is an internet connection. It does not make an ajax callback to the Alpha Anywhere server. Is merely uses the HTML5 property. The .serverIsAvailable() method, on the other hand, does a lightweight callback to the Alpha Anywhere server to test if the server is available.


The function will set these variables in the global A5 JavaScript object:

A5._serverAvailable - true/false
A5._serverCheckTime - the time the server availability was last checked.


Execute the 'refreshList' action is the server is available.

function success() { 


Example: Passing in an Error Function

var _ok = function() {
    alert('server responded');

var _err = function() {
    alert('server did not respond');

//wait up to 500 milliseconds before calling either the _ok or _err callback function

See Also