Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Section A.19. Chapter 19 Answers

A.19. Chapter 19 Answers


Question 19-1

To implement an Ajax connection, YUI uses a method called asyncRequest, which is referenced as YAHOO.util.Connect.asyncRequest.


Question 19-2

A callback object called callback for YUI, referring to a success handler called succeeded and a failure handler called failed, would be written like this:

callback = { success:succeeded, failure:failed }


Question 19-3

A GET call to asyncRequest that refers to the program getdata.php and a callback object would look like this:

request = YAHOO.util.Connect.asyncRequest('GET', 'getdata.php', callback);


Question 19-4

To encode the URL mysite.com/message?m=123, which contains the ? symbol, so that if sent as a GET request, it will be treated just as a string and not interpreted, use the encodeURI method, like this:

url = encodeURI("mysite.com/message?m=123")


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial