Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
DHTML Utopia Modern Web Design Using JavaScript & DOM- P16:In a single decade, the Web has evolved from a simple method of delivering technical documents to an essential part of daily life, making and breaking relationships and fortunes along the way. “Looking something up on the Internet,” by which is almost always meant the Web, is now within reach of almost anyone living in a first-world country, and the idea of conducting conversations and business (and probably orchestras) in your Web browser is no longer foreign, but part of life | Chapter 9 Communicating With The Server In the above example the XML-RPC API s method names contain a dot . so they won t work as JavaScript method names. We ve therefore used the second technique to assign simpler method names. In either case we must specify the location of the XML-RPC API this is sometimes called the endpoint and is the URL of the script to which you pass the XML-RPC commands . The remote method becomes accessible as a method of the API object. What that actually means in plain English is that code can now call the remote blogger.getRecentPosts method transparently by calling the following for example var result remoteAPI.getRecentPosts arguments Pages that make these calls are normally retrieved from the same server that processes the calls. Security restrictions prevent you from loading a page from one server and making XML-RPC calls to a server that s located elsewhere. So in JavaScript the client and server form a consistent pair. This is not true of Web services in general. Example Weblog Post Editor Armed with this knowledge of the Blogger API and a trusty XML-RPC client library we can very easily build a simple post editor for a Weblog. Only three actions are required 1. Get a list of posts from the server. 2. Display the content of one of the fetched posts for editing. 3. Save the edited post back to the server. Before we design our page it makes sense to confirm that the Blogger API can do what we want it to. All APIs are different there s no point committing to a big design project if the XML-RPC system won t support it. Exploring the Blogger API For all three of the required actions start by turning to the Blogger API specification. That document states that the method signature for blogger.getRecentPosts requires five arguments appkey blog name username password and number of posts. The first four are specific to the Weblog in use appkey may be blank for non-Blogger Weblogs that support the Blogger API . 280 Licensed to .