Asynchronous operations using prototype.js_prototype
WBOYOriginal
2016-05-16 19:19:331156browse
First download the prototype.js class package, and then include it in your page
Create an XMLHttpRequest object and asynchronously track its process, then parse the response and process it as possible This is the fundamental meaning of ajax, its most powerful place, but you can write code that is compatible with various browsers, which may make you miserable, but fortunately prototype.js, which comes to the rescue, provides the Ajax.Request class to let you get rid of it. These troubles.
Suppose you have an application that can communicate with the server through the url http://ajax.boogu.com/cm.html. It returns an XML response like below. (Of course this is impossible)
1234 > >
It is very simple to use the Ajax.Request object to communicate with the server and get this XML. The example below demonstrates how it is done. Buchanan, Steven Callahan, Laura
Davolio, Nancy
1996
Did you see the second object passed into the Ajax.Request constructor? Parameters {method: 'get', parameters: pars, onComplete: showResponse} represent the actual writing of an anonymous object. He means that the object you passed in has an attribute named method with a value of 'get', another attribute named parameters that contains the query string of the HTTP request, and an onComplete attribute/method that contains the function showResponse.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn