Hi,
I am completing the checkout process on my shopping cart and am sending the payment details to my bank.

I have sorted out all of the Cross Origin stuff and I'm receiving the expected resonse to my Payment form POST and puuting it into an iFrame (via forms target=responseiframe).

My documentation says I will receive will receive an XML response:

<?xml version="1.0"?>
<response CUSTOMERID="999" AMOUNT="999" STATUS="999" ERROR="999" ></response>

I can see via the browser inspector the document exists.

<iframe src="" name="responseiframe"  id="responseiframe">
                 #document
               <response  CUSTOMERID="999" AMOUNT="999" STATUS="999" ERROR="999">
                </response>
</iframe>

My question is, how do I access the document in the iframe and parse the attributes of the response tag.

I'd really appreciate some help on this as every conventional javascript method I've used (getElementById, contents.find, etc, etc) has proven fruitless.

Thank you

Recommended Answers

All 3 Replies

You can only read it if it originates from the same domain. Same origin policy prohibits reading iframe source from a different domain.

Thanks pritaeas,
That sort of makes sense, but the banks xml response is meant to be read. I have configured Apache to read the response (Access-Control-Allow-Origin, etc) and have the required modules loaded. Does that mean I have to read the xml response as it is responded, i.e. witinin success of Ajax post?

That would make more sense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.