tailieunhanh - Beginning Ajax with ASP.NET- P8

Beginning Ajax with P8:Thank you for purchasing Beginning Ajax with . We know that you have a lot of options when selecting a programming book and are glad that you have chosen ours. We’re sure you will be pleased with the relevant content and high quality you have come to expect from the Wrox Press line of books. | The XMLHttpRequest Object while the user is still manipulating the information within the browser. This represents the heart of Ajax and is the core advantage that it represents within traditional browser applications. A user can continue to work within the browser application uninterrupted while in the background a request is sent and a response that contains the result of some server-side processing is received. Synchronous Requests Take a look at a following simple code example of a synchronous operation and then take a look at the explanation of exactly what is occurring that follows. Note The code for the inclusion of the script include file mentioned previously has been omitted for brevity. Try It Out A Synchronous Operation function MakeXMLHTTPCall var xmlHttpObj xmlHttpObj CreateXmlHttpRequestObject if xmlHttpObj GET http XmlHttpExamplel false null alert Request Response Complete. How It Works The preceding code sample is very simple however it does show the basic usage of the XMLHTTP object. If you examine the code in detail you ll see the following 1. First you create a new XMLHTTP object and assign it to a variable. 2. After checking if the object is not null that is that the object creation in Step 1 was successful you execute the open method passing in three parameters GET http XmlHttpExamplel false The first parameter GET is the type of request to make this can be any of the standard HTTP verbs get post put or head The second parameter is the server address or endpoint to make the request to. In this case it s an XML file located at http localhost . The third parameter false indicates whether a synchronous or asynchronous request should take place. In this case false indicates that a synchronous request should occur. 3. The send method is executed on the XMLHTTP object instance to perform the actual request.

TỪ KHÓA LIÊN QUAN