AJAX timeout with POST-ing to `/index.php/leadCapture/save2`
So, we've been experimenting with POSTing our form submission data directly to `/index.php/leadCapture/save2. We are interested in doing this because we have our own custom form journey, and we basically followed along with the same logic that's in Marketo's forms2 github. We are using AJAX to POST to Marketo, ie:
this.ajax = $.ajax({
method: "POST",
context: this,
url: "https://marketostuff.com/index.php/leadCapture/save2", //this is a dummy url
contentType: 'application/json',
dataType: 'jsonp',
timeout: 7000,
data: this.payloadState,
beforeSend: this.ajaxBeforeSendFn,
})
.done( this.ajaxSuccessFn )
.fail( this.ajaxErrorFn )
.always( this.ajaxAlwaysFn );
So out of like 100 or so tests, we've noticed that 2-3 have resulted in a timeout error. Not getting any response headers back. Everything else is working like a champ! The timeout response looks like:
"response": {
"readyState": 0,
"status": 0,
"statusText": "timeout"
}
So, i'm wondering what might be going on if this function works 97-98% of time time, what could be causing the response to timeout? We do have a timeout limit in our AJAX call (7 seconds).... which I imagine is actually timing out. Not sure if things are getting stuck in Preflight... but at the very least we know that we aren't getting any response, so it doesn't seem like a preflight rejection outright.
Does anyone have thoughts? Thanks so much for your help and time,
Gabriel