Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
New Member
Posts: 12
Registered: ‎01-20-2012

Making Synchronous calls using the sData Client Library

Most of the request objects in examples use an asynchronous call to sData. For example,

 

request.execute(entry,{
success: this.onRequestDataSuccess,
failure: this.onRequestDataFailure,
aborted: this.onRequestDataAborted,
scope: this
});

 

but if you require data before the end of the current method, you'll probably want to use a synchronous request. You can do this by adding the async property to the options object to specify this call.

 

var xmlHttpRequestObject = request.execute(entry, { scope : this , async : false});

var myData = xmlHttpRequestObject.responseText;

 

(FYI, In my examples I was using a SDataServiceOperationRequest object)