SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 97 | Next

Robin Pars, Laurence Moroney, and John Grieb

"Foundations of ASP.NET AJAX"


In this example, you need to implement the callback functions like this:
function onComplete(result)
{
alert("The car is worth s$" + result);
}
function onError(error)
{
alert(error.get_message());
}
If the call to the web service completes successfully, then the result is passed back to
the onComplete function, in this case, the calculated value of the car. If it fails, an error
object is passed to the onError function. The message associated with the error can be
obtained by calling the object??™s get_message method.
Figure 3-14 shows the application calculating the value of a 2005 Honda Pilot at
$36,000, and the method onComplete displaying the results.
CHAPTER 3 ?–  THE MICROSOFT AJAX LIBRARY: MAKING CLIENT-SIDE JAVASCRIPT EASIER 53
Figure 3-14. The result of a call to the getCarValue web service
Summary
In this chapter, you were introduced to the power that the Microsoft AJAX Library adds to
JavaScript. You learned about the extensions implemented in the file MicrosoftAjax.js that
add true object-oriented programming to JavaScript, with features such as inheritance,
namespaces, interfaces, and classes.


Pages:
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109