An example of a very
basic HTTP GET to set the variable var on the server to value 1 is shown here:
GET http://www.example.com/site.jsp?var=1
HTTP Form POST
Much like HTTP GETs, HTTP Form POSTs are the traditional method of making calls to
methods on the server and changing state. Even though the XMLHttpRequest object
Chapter 6: AJAX Types, Discovery, and Parameter Manipulation 151
offers the ability to send upstream traffic in any format, a number of AJAX frameworks
such as Direct Web Remoting still utilize name-value pairs. Here??™s an example of a client
using an HTTP Form POST using traditional name-value pairs to call a method on a
server. In this example, the client is calling the getMessages method in the script Chat.
callCount=1
c0-scriptName=Chat
c0-methodName=getMessages
c0-id=818_1151685522576
xml=true
JavaScript Arrays and JSON
JavaScript Arrays or JSON may also be used as an upstream protocol. Either one of these
is often used in a situation where the web application has a built-in serialization function.
Whenever a downstream or upstream request is going to be made, it is passed to the
serialization function, which either converts it to JavaScript arrays or JSON and then
forwards it on to the server or client.
Pages:
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291