I have problems with Javascript: I created this page:
<html> <body> <iframe id="a" src="iframe.php" width="500" height="200"></iframe> </body> </html>
and inside iframe.php , I just repeat the JSON line:
<?php $json = array( 'status' => 'error', 'html' => '<span class="cool">This is a string</span>' ); echo json_encode( $json );
What I want is to get the correct source string echoed by iframe.php using Javascript (possibly jQuery) and parse it as a JSON object.
But the problem is that I always get the wrong content. I tried the method described here and jQuery('iframe').contents().find('body').html() , but no luck. The span tag is missing or not formatted correctly.
Please help me. Thanks.
source share