request.method

NES2+Syntax

request.method

Description

The method property of the request object specifies the HTTP method used in the request. This can either be PUT or GET, depending on the submission type.

Example

Listing 8.109 shows how you can use the same page to display a form and interpret it. If the method is POST, you know it was a form submission. If it was GET, you display the form.

Listing 8.109 Evaluating the method Property
<SERVER>

// See if they have submitted or just need the form
if(request.method == "POST"){

  // Perform your processing of the form here

}else{

  //  Write the actual HTML form here

}

</SERVER>
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.