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.
<script
src="http://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key"
type="text/javascript"></script>
<script type="text/javascript">
function loadIntegr8() {
data8.load('TPS');
}
function checkTPS() {
var telno = document.getElementById('telno');
var service = new data8.tps();
service.iscallable(telno.value, null, showResult);
}
function showResult(result) {
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.