Ajax Services
 

Integr8 Ajax Methods

All our Integr8 services are available via our Ajax API as well as traditional SOAP web services. In order to access the services via Ajax, you will first need to generate an Ajax API key for the web site you want to use the services from.

Once you have your key, you can load in the Integr8 services you require using Javascript such as that shown below with no need for any server-side coding. The first <script> tag loads the main Integr8 Ajax API. You can then use the data8.load(service-name); function to load the services you want to use. All the same methods are then available to you as are available via web services, except that username and password parameters have been removed and a new callback parameter has been added at the end, which is called asynchronously when the method has finished.

            <!-- Import the Integr8 Ajax API -->
            <script type="text/javascript" src="http://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key">
            </script>
            
            <script type="text/javascript">
              function loadIntegr8() {
                // Load the required Integr8 services
                data8.load('TPS');
              }
              
              function checkTPS() {
                // Create a new instance of the TPS service and call the IsCallable method
                // with the required telephone number. Supply the showResult method as a
                // callback method for when the results are ready.
                var telno = document.getElementById('telno');
                var service = new data8.tps();
                service.iscallable(telno.value, null, showResult);
              }
              
              function showResult(result) {
                // Check that the TPS lookup succeeded, and show the error message if there 
                // was a problem. Otherwise, show a message to indicate if the number is callable or not.
                if (!result.Status.Success) {
                  alert('Error: ' + result.Status.ErrorMessage);
                }
                else if (result.Callable) {
                  alert(result.TelephoneNumber + ' is NOT on TPS');
                }
                else {
                  alert(result.TelephoneNumber + ' is on TPS - DO NOT CALL');
                }
              }
              
              loadIntegr8();
              
            </script>
            
            <input type="text" id="telno" />
            <input type="button" onclick="checkTPS();" value="Check TPS" />  
        

This code allows you to quickly add professional quality data services into your Web 2.0 mashup sites, such as the Telephone Preference Service (TPS) checking box shown below. This sample, along with other demonstrations on this site, is limited to 10 lookups per day. The live version of the service does not have any usage restrictions.

TPS Check
Enter your telephone number below and click Check TPS to see if you are registered with the telephone preference service.
Skip Navigation Links
Request handled by server S1 for client 38.107.191.80 at 11/03/2010 19:12:17