Adobe Marketo Javascript API Issue

Level 1

Adobe Marketo Javascript API Issue

We are attempting to utilize the JS API for Marketo to send tracking events upon successful submission of the forms that would redirect the user to a custom URL triggered  by the  form submission onSuccess event handler.


The issue I am seeing is that when the onSuccess event handler is executed, the only way to have custom redirects is to use location.href and because of the nature of the redirect , how wall network requests are cancelled once the browser identifies it is being asked to change page location.


Can an update be made to the JS API. Instead of asking us to return false and handle the redirect ourselves it would be ideal to allow us to pass the customized URL to have the code go ahead and redirect to after all the onSuccess handlers are executed(unless false is returned). Can provide if there is a recommended way to go about this, or can you help some to this solution.

Level 10 - Community Moderator

Re: Adobe Marketo Javascript API Issue

You haven’t shown your code (and should) but on the surface what you’re asking is impossible.


If you have a custom onSuccess listener calling a function which makes an async request to a random server, Marketo has no automatic way of knowing when that request is complete. (It knows when the initial function call has returned, of course, but that’s not the HTTP request.)


That’s why you wait for your requests to complete before changing location.href.