Skip to content

Instantly share code, notes, and snippets.

@jdeblank
Created April 18, 2019 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jdeblank/f3713d91ff3b3174d5cdaad8f7ad44d3 to your computer and use it in GitHub Desktop.
Save jdeblank/f3713d91ff3b3174d5cdaad8f7ad44d3 to your computer and use it in GitHub Desktop.
<script runat="server">
Platform.Load("core","1.1.1");
/*
Example that handles JSON data POSTed to this page.
e.g '{"firstname":"Joe","lastname":"Bloggs"}'
*/
var jsonpost, jsondata;
//Use JSON in post content
jsonpost = Platform.Request.GetPostData();
if (jsonpost.substring(0, 1) != '-') {
// Parse JSON
jsondata = Platform.Function.ParseJSON(jsonpost);
var Firstname = jsondata.firstname;
var LastName = jsondata.lastname;
Write("Hello " + firstname + " " + lastname);
// Hello Joe Bloggs
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment