I am creating a Landing Page (Microsite to be specific) in ExactTarget and want the form parameters to be passed on to the next page for execution.

Here is my code so far:

<script runat="server">
Platform.Load("core", "1");

function post(){
    //Assigning variables
    var username = Platform.Request.GetFormField('username');
    var useremail = Platform.Request.GetFormField('useremail');
    var listkey = Platform.Request.GetFormField('listkey');
    var emailname = Platform.Request.GetFormField('emailname');
    var round = Platform.Request.GetFormField('round');
    //Assigning URL
    var url = 'http://pages.s4.exacttarget.com/page.aspx';
    var contentType = 'text/xml';
    //Assigning payload
    var payload = "QS=5c591a8916642e7339e4e4a40314ee29de7b81aa289f8dc75e04d18f0c1xxxx&username=" + username +"&useremail=" + useremail +"&listkey=" + listkey +"&emailname=" + emailname +"&round=" + round;
    var result = HTTP.Post(url, contentType, payload);
    Write(result.StatusCode + '<br>'); //Response: 200
    Write(Stringify(result.Response)); //Response: ["\r\n\r\n\r\n\r\n\t\r\n\t\n\n\n\n\n\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"] 


<form onsubmit="post()">
    <input type="text" name="username" placeholder="Your name..."><br />
    <input type="text" name="useremail" placeholder="Your email address..."><br />
    <input type="text" name="listkey" placeholder="List external key..."><br />
    <input type="text" name="emailname" placeholder="Email name..."><br />
    <input type="text" name="round" placeholder="QC Round Number..."><br />
  <input type="submit" value="Send a round">


The initial page loads with the form elements showing correctly, but upon submission I receive an error ("The page you requested is unavailable") and the address bar shows "http://pages.s4.exacttarget.com/page.aspx?username=123&useremail=123&listkey=123&emailname=123&round=123".

It looks like ExactTarget isn't accepting the QS parameters I passed through as part of the payload. Is there any way to get this to work?

2 Answers 2


The function post() is defined in server-side code but client-side code is attempting to call it. It doesn't appear that the post() method does any manipulation on the form field value so it is just a pass-through.

Any reason to not just use the standard form action/method options?


<form onsubmit="post()">


<form action="http://pages.s4.exacttarget.com/page.aspx?QS=5c591a8916642e7339e4e4a40314ee29de7b81aa289f8dc75e04d18f0c1xxxx" method="post">

Then remove the post function from the first page.


Along the lines of what @Mac has suggested, here's my base custom preference center template. It posts to itself:

%%[ set @UrlThis = RequestParameter('PAGEURL') ]%%
<script type="text/javascript" runat="server">

    Platform.Load("core", "1");

    var debug = false;

    if (Request.Method == "GET") {

        if (debug) {

        // retrieve values from the subscriber context or URL parameters using Attribute.GetValue("VARNAME")) or Request.GetQueryStringParameter("VARNAME"));

        // in your email, use the AMPScript MicrositeURL() function with the landing page page id to ensure the subscriber context is passed to your landing page

        // set AMPScript variables using the SetVar function below

    } else if (Request.Method == "POST") {

        if (debug) {

        // retrieve POST values using Request.GetFormField("VARNAME")

        // do the appropriate API call

        // redirect to the RESULTURL based on success or failure of API call


    function SetVar(varName, varValue){
        eval(varName + "='"+ varValue + "'");
        Variable.SetValue(varName, varValue);

    if (debug) {
        Write("<br><br>debug output: " + Stringify(ARRAYVAR));
        Write("<br><br>debug output: " + STRINGAR);

      <form id="formName" action="%%=v(@urlThis)=%%" method="post" enctype="application/x-www-form-urlencoded">
        default form values with %%=v(@VARNAME)=%% or <ctrl:eval>VARNAME</ctrl:eval>

Source is also available here: http://pastebin.com/6sai85pY

  • Thanks, I'll take a look into this for when I need the page to post to itself :) Aug 26, 2015 at 15:30

You must log in to answer this question.

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