GetPostData

Overview

Returns the data from the POST payload sent to the requested resource as a string, converted using the provided optional encoding parameter. A common use case is processing JSON payloads supplied to a page. For accessing data sent via a form POST request, use: Platform.Request.GetFormField(fieldName).

Syntax

GetPostData(1)

Function Properties

OrdinalTypeDescription
1stringEncoding format. If no value is entered, the encoding format will default to Windows-1252.

Encoding

The example above defaults to Windows-1252 encoding.

If the incoming request uses a different encoding format, such as UTF-8, the encoding can be provided using the optional parameter, shown in the example below.

Examples

The examples below assign the JSON data posted to the page to the “json” variable, converting it to a JS object.

Example using Microsoft Windows-1252 encoding (default):

Example using UTF-8 encoding: