tailieunhanh - Developing Large Web Applications- P22

Developing Large Web Applications- P22:This book presents a number of techniques for applying established practices of good software engineering to web development—that is, development primarily using the disparate technologies of HTML, CSS, JavaScript, and server-side scripting languages. Whereas there are many books on how to use languages, how to use libraries, and how to approach software engineering, this is the first book to codify many of the techniques it presents. These techniques will make the components of your own web applications more reusable, maintainable, and reliable | Do what is needed when the Ajax call returns on a failure. _ POST The following method executes an Ajax POST request with jQuery. The parameters for the method are the same as described for GET except you set the type member to POST url type POST timeout 5000 data keyl vall key val2 . dataType json success function data Do what is needed when the Ajax call returns successfully. error function xhr text error Do what is needed when the Ajax call returns on a failure. _ Ajax with Prototype Prototype is one of the earliest of the JavaScript libraries to support Ajax. You can download the library and read its complete documentation at http .org-. GET The following method executes an Ajax GET request with Prototype. The method accepts two parameters the destination for the request and an object whose most common members are shown below. In the handler specified by onSuccess you access for responses using plain text. For XML responses will have been populated with a DOM that you can access with JavaScript DOM methods. For JSON responses the member will have been populated with the JavaScript object that is the result of the evaluated response text. You specify the query parameters for the GET as an object in the parameters member In the Browser 191 method get parameters keyl vall key2 val2 . onSuccess function transport Do what is needed when the Ajax call returns successfully. onFailure function transport Do what is needed when the Ajax call returns on a failure. POST The following method executes an Ajax POST request with Prototype. The parameters for the method are the same as described for GET except you set the method member to post method post parameters keyl vall key2 val2 . onSuccess function transport Do what is needed when the Ajax call returns successfully. onFailure function transport Do what is needed .