AT&T Developer's Challenge Demo AJAX API Caller

The following code will make an HTTP GET request to the Developer's Challenge API and log the request. You can then view the results in the status tab of the Developers Challenge Facebook application. Simply past your application key below along with a Facebook ID (integer) and submit the request.

This example uses a client side implementation of the httpRequest object in JavaScript. It has been tested for IE7 or less and Firefox. You may use this code in your application if you choose but be aware that if creating a native FBML application Javascript is limited and you should look at the new FBJS API that Facebook has released. This code is offered under the open source license. To download the Javascript object see the bottom of this document. If you need more information on using the AJAX API then please contact us on the Developers Challenge Home Page Discussion Board.

Your application Key [appKey]
FaceBook User ID [fbid]
Text Message [iText]
Image Message [iImage]
Video Message [iVideo]
iRingTone Message [iRingTone]
 

AJAX API Example Call and documentation
function doRequest(){
myRequest=new clsDevChallengeAPI()
myRequest.async=false;
myRequest.onSuccess=pass;
myRequest.onFailure=fail;
myRequest.appKey=[Your application key as string]
myRequest.fbid=[User Facebook ID as number]
myRequest.iText=[0=False | 1=True]
myRequest.iImage=[0=False | 1=True]
myRequest.iVideo=[0=False | 1=True]
myRequest.iRingTone=[0=False | 1=True]
myRequest.call()

function pass(){
Do something
}
function fail(){
Do something
}
}


DOCUMENTATION
Instantiation: Var myCaller = new clsDevChallengeAPI()

Properties
.rootPathRoot Path of Web Service, should not be changed. Set to http://www.developerschangle.com/attfb.asmx/msg by default
.methodMethod of Call, should not be changed. Set to GET by default
.asyncMake the call Asyncrously or not. Set to False by default. The web service is very quick in its response and setting Async to true and making multiple rapid calls may result in missed responses.
.appKeyYou application key
.fbidUser Facebook ID as number
.iTextSet if text message has been sent, 1=true | 0 = False
.iImageSet if image message has been sent, 1=true | 0 = False
.iVideoSet if Video message has been sent, 1=true | 0 = False
.iRingToneSet if RingTone redirect has been requested, 1=true | 0 = False
.resultBoolean indicating is last call was successfull

Events
.onSuccessFires when call has completed and was successful. Set to function pointer
.onFailureFires when call has completed and failed. Set to function pointer
.onLoadingStandard HttpRequest Object State, set to function pointer
.onLoadedStandard HttpRequest Object State, set to function pointer
.onInteractiveStandard HttpRequest Object State, set to function pointer

Methods
.call()Makes a call to the web service. Returns true or false on success of call when Async is set to False.

clsDevChallengeAPI Source Code