08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 12 ■ <strong>AJAX</strong> EXTENSIONS FOR <strong>ASP</strong>.<strong>NET</strong> 303<br />

Figure 12-19. Accessing the JavaScript proxy<br />

This proxy file will look something like this:<br />

var DataService=function() {<br />

DataService.initializeBase(this);<br />

this._timeout = 0;<br />

this._userContext = null;<br />

this._succeeded = null;<br />

this._failed = null;<br />

}<br />

DataService.prototype={<br />

GetCountryForRegion:function(<br />

strRegion,succeededCallback, failedCallback, userContext)<br />

{<br />

return this._invoke(DataService.get_path(),<br />

'GetCountryForRegion',false,{strRegion:strRegion},<br />

succeededCallback,failedCallback,userContext); }}<br />

DataService.registerClass('DataService',Sys.Net.<strong>Web</strong>ServiceProxy);<br />

DataService._staticInstance = new DataService();<br />

DataService.set_path = function(value)<br />

{ DataService._staticInstance._path = value; }<br />

DataService.get_path = function()<br />

{ return DataService._staticInstance._path; }<br />

DataService.set_timeout = function(value)<br />

{ DataService._staticInstance._timeout = value; }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!