forked from docker/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
XDFrame.html
50 lines (49 loc) · 1.73 KB
/
XDFrame.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<!-- saved from url=(0051)https://app-sj05.marketo.com/index.php/form/XDFrame -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Marketo Forms 2 Cross Domain request proxy frame</title>
<script src="forms2.min.js"></script>
<script>
(function (){
var $ = MktoForms2.$;
if(!window.parent || window.parent == window){
return;
}
$(window).on("message", function (e){
var origin = e.originalEvent.origin;
var message = e.originalEvent.data;
try{
message = $.parseJSON(message);
}catch(ex){
return; //our messages are always JSON
}
if(message && message.mktoRequest && message.mktoRequest.ajaxParams){
var params = message.mktoRequest.ajaxParams;
params.success = function (data){
window.parent.postMessage(JSON.stringify({
mktoResponse:{
"for":message.mktoRequest.id,
error:false,
data:data
}
}), origin);
}
params.error = function (error, code, errMessage){
window.parent.postMessage(JSON.stringify({
mktoResponse:{
"for":message.mktoRequest.id,
error:true,
data:errMessage
}
}), origin)
}
$.ajax(params);
}
});
window.parent.postMessage(JSON.stringify({mktoReady:true}), "*");
})()
</script>
</head>
<body>
<h2>This page is used by Marketo Forms 2 to proxy cross domain AJAX requests.</h2>
</body></html>