1

I have a CloudPage which I post to using form data, using SSJS I want to retrieve the url form input.

How can I do this?

Below you can find the code I have used but this doesn't appear to work, I've also tried variations like postData.url but this does not work either.

It should be noted Platform.Request.GetPostData() returns a string and not JSON.

<script runat=server language="javascript">
  Platform.Load("Core", "1");

  if (Request.Method == "POST") {
      // Handle post
      var postData = Platform.Request.GetPostData();
      var jsonPost = Platform.Function.ParseJSON(postData);
      Write(Stringify(jsonPost.url));
  }

</script>
0

1 Answer 1

3

You can retrieve form data using the following function in SSJS.

Platform.Request.GetFormField("attribute-here")

To retrieve the url form parameter you need to use Platform.Request.GetFormField("url")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .