Redirect confirmation page from returned json

  • 10 October 2019
  • 0 replies
  • 6 views

I am posting my form data to a URL, that URL returns json:

{“Success”:“true”,“Error”:null,“FirstTimeLoginURL”:“https://mydomain.com/first-time-login/unique-string”}

I am having trouble figuring out how to write a script to redirect my “thank you” page to that FirstTimeLoginURL

I have the page working on my current site (not using unbounce), but we want to convert that page to unbounce. The basic version of the script that is currently working on existing site is:

$.ajax({ 
url: "post data url", 
data: JSON.stringify(dataString), // data being inserted to form
dataType: "json",
type: "POST",
contentType: "application/json",
success: function(json) {  
  window.location.href = json.FirstTimeLoginURL;
});

(this is a very trimmed version of the full script, but it’s the meat and potatoes of what needs to happen basically)

How can I add something similar to my scripts on this page to redirect to my FirstTimeLoginURL value, thank you.


0 replies

Be the first to reply!

Reply