1 Reply Latest reply on Sep 15, 2015 5:02 AM by BKBK

    json from an iframe to coldfusion structure or parm

    nosredna

      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>