jQuery plugin v1.0

 

jQuery plugin is a simple way to access ISL Online Account API from web sites. It requires jQuery 1.0 or higher. All calls in jQuery plugin are made witj JSONP encoding (due to possible cross-domain request). You cannot create multiple jobs in hosted services methods using this plugin.

Usage

$("#element-id").('method', { options });

where method is any of the supported methods (see Methods section for more information). Plugin will search for required fields inside the element. Fields must be marked with correct class name (ie. class="username" for username field). Method can be called on any container element. Element with classname submit will act as submit button when clicked.


Example:

<!doctype html>

<html>

<head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <title>Test page for API</title>

    <script type="text/javascript" src="jquery-1.7.1.min.js"></script>

    <script type="text/javascript" src="islonline.account.jquery.js"></script>

    <script type="text/javascript">

        function doAfterLogin() { alert('Login successful'); }

        function doLoginFailed() { alert('Login failed'); }

        $(document).ready(function () {

            $('#login').islonline('accountLogin', { onSuccess: 'doAfterLogin', onFail: 'doLoginFailed' });

        });

    </script>

</head>

<body>

    <h1>Login</h1>

    <div id="login">

        Email: <input type="text" class="username" /><br/>

        Password: <input type="text" class="password" /><br />

        <input type="button" class="submit" value="Login" />

    </div>

</body>

</html>

As you can see, login was executed on fields inside login div. On succesful login, doAfterLogin function is called and on failed login, doLoginFailed executes.

 

Available options

  • resellerId [integer] 
    Set reseller ID. If none is set HQ's ID is set by default 
  • timezone [integer]
     timezne offset in minutes  
  • onError [callback]
    Which function to execute if error occurs. 
  • onFail [callback]
    Which function to call if method response is METHOD_FAIL. This does not mean, that there was an error while executing method on API side, it usually means data was inconsistent with the requested method. 
  • onSuccess [callback]
    Which function to call if method returns OK.

Was this article helpful?