user937450
user937450

Reputation: 733

Get JSON text from HTML iframe

I want to submit a form into an iframe and get the result. The result has to be a text that javascript can understand, so I think that JSON is the best idea.

I know how to get the iframe object on javascript, but I have no ideia on how to get the content. The content of my iframe is only JSON, how can I retrieve it with javascript?

Upvotes: 1

Views: 2420

Answers (1)

TGH
TGH

Reputation: 39258

You can communicate via JavaScript.

The parent window can be reached using the parent property inside the iframe:

From the iframe do

window.parent.SomeFunctionDefinedInTheParent(JSONObject);

Upvotes: 3

Related Questions