0

I have a web collect form that will be used in a light box modal for email capture. On the form submission I have a function to hide the div that contains the form and display the thank you div but it still redirects to an ExactTarget "Thank You" page before it has a chance to display the div. If I go back, the thank you div is displayed but I need to stop the redirect altogether. This there a way to stop this?

Here is an example of where the redirect is happening:

<form action="http://cl.exct.net/subscribe.aspx?lid=ExampleListID" method="post" id="signup" onsubmit="switchVisible()">
0

Here is the documentation on the SFMC/ExactTarget Web Collect functionality.

You can specify the Thank You and Error URLs -- if that helps.

You don't have to do a traditional form POST with a redirect. You can do it all with AJAX and parse the results.

  • 1
    Adam Spriggs, do you have any example code available. I thought I had it but now I am getting this error: XMLHttpRequest cannot load cl.exct.net/subscribe.aspx?LID=ExampleLID. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. and due to this not submitting, I still don't know if my success div will display. Thank you! – Stacy Sep 10 '15 at 15:10
  • Here is what I have: $("#signup").submit(function() { var data = { "SubAction":"sub_add_update", "First Name":$("#firstName").val(), "Last Name":$("#lastName").val(), "Email Address":$("#email").val(), "Child Birthday or Expected Due Date":$("#childBday").val(), "thx":" Backup Success URL" }; $.post("http://cl.exct.net/subscribe.aspx?LID=ExampleLID",data,function switchVisible() { console.log(data); }); return true; }); – Stacy Sep 10 '15 at 15:44
0

In the end of your function, you should to avoid the default action - Submit, use Jquery:

function yourFunction(event) {
    // Your codes here.
    event.preventDefault();
}

Hope can help you.

  • thanks, but this did not work fully to submit the form and return the success div. – Stacy Sep 10 '15 at 15:18
  • hum, so you try this: function yourFunction(event) { event.preventDefault(); // Your codes here.</br> return false; // Cancel action. } – Leisure Sep 14 '15 at 3:50
0

Add your landing form page URL as your success URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.