• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

json from an iframe to coldfusion structure or parm

New Here ,
Sep 09, 2015 Sep 09, 2015

Copy link to clipboard

Copied

I am trying to figure out how to get json data that is coming from an iframe response into a coldfusion parameter or structure that I can use.  The iframe is within a form and when submitted it executes the doMonerisSubmit function in the javascript.  Below is the javascript which returns the information but I need to get it into CF.  If it was using a cfhttp post I could do it, but I'm at a loss as to how to capture it when it's being executed in this javascript.  I've been working on this off and on for the past month and I'm no closer to a solution now than I was a month ago.  Any insight would be appreciated.

Thanks.

<script>
function doMonerisSubmit()
{
var monFrameRef = document.getElementById('monerisFrame').contentWindow;
monFrameRef.postMessage('','https://esqa.moneris.com/HPPtoken/index.php');
return false;
}
var respMsg = function(e)
{
var respData = eval("(" + e.data + ")");

document.getElementById("monerisResponse").innerHTML = e.origin + " SENT " + " - " +
respData.responseCode + "-" + respData.dataKey + "-" + respData.errorMessage;
document.getElementById("monerisFrame").style.display = 'none';
}
window.onload = function()
{
if (window.addEventListener)
{
window.addEventListener ("message", respMsg, false);
}
else
{
if (window.attachEvent)
{
window.attachEvent("onmessage", respMsg);
}
}
}
</script>

TOPICS
Advanced techniques

Views

581

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2015 Sep 15, 2015

Copy link to clipboard

Copied

LATEST

So far, you are receiving the information in the browser. You could, for example, add AJAX code that would send that information to the Coldfusion server, that is, to a CFM page, via a GET or POST method. Google will tell you more.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation