将php数组传递给父javascript main

I'm stack in something that I don't understand really. I got a Javascript page as parent of an Iframe, the iframe executes its rutine in php and then sends back some html info and some variable and an array, here is the prob, How do I send properlly the array respecting as much as possible the code I have?

JAVASCRIPT:

function showPlaceFrame(user_id,page_id){
  var number = user_id;
  var locationId = page_id;
  var iFrameOF = document.createElement('iframe');
  iFrameOF.id = 'locationFrame';
  iFrameOF.src = '/php_fyles/openPlace.php?user_id='+number+'&page_id='+locationId;       
  iFrameOF.style.float = 'top';
  iFrameOF.frameBorder='0';             
  var homeExtendedDiv_ = document.getElementById("homeExtendedDiv");
  homeExtendedDiv_.appendChild(iFrameOF);
}

PHP:

$result=mysql_query("SELECT * FROM places WHERE page_id=" . $page_id, $link);
$fqlPlace = 'SELECT page_id,name,description FROM place WHERE page_id=' . $page_id;
$ret_obj_place = $facebook->api(array(
    'method' => 'fql.query',
    'query' => $fqlPlace,
));

echo '<script type="text/javascript" charset="UTF-8">';
echo 'var result1 = ' . json_encode($result) . ';';
echo 'var result2 = ' . json_encode($ret_obj_place) . ';';
echo 'parent.parsePlaceFrame()'; 
echo '</script>';

BACK TO JAVASCRIPT:

function parsePlaceFrame(){
    var locationFrame_ = document.getElementById("locationFrame");                              
    FB.XFBML.parse(locationFrame_);
    autoResize("locationFrame");
    var iFrameOF = document.getElementById('locationFrame');
    var innerDoc = iFrameOF.contentWindow.document;
    var result1 = innerDoc.getElementById('result1'); //These are tries
    var result2 = innerDoc.getElementById('result2'); //These are tries
    alert(result2);                                   // 
    var ge1 = iFrameOF.contentWindow['result1'];      //
    var ge2 = iFrameOF.contentWindow['result2'];      //
    alert(ge1);                                       //These are tries
    alert(ge2);                                       //
}

What I'm getting right now is a "null" value and I'm sure it is not empty in php because I've checked it. Any idea?

Rather than using var result = try setting a global variable there, using window['result']= or parent['result] to set a global javascript variable. When parsePlaceFrame is called, you can immediately access the variable, rather than trying to claim it from the iFrame.

EDIT: UPDATE

In your PHP, you have this:

echo '<script type="text/javascript" charset="UTF-8">';
echo 'var result1 = ' . json_encode($result) . ';';
echo 'var result2 = ' . json_encode($ret_obj_place) . ';';
echo 'parent.parsePlaceFrame()'; 
echo '</script>';

try changing it to this:

echo '<script type="text/javascript" charset="UTF-8">';
echo 'window[\'result1\'] = ' . json_encode($result) . ';';
echo 'window[\'result2\'] = ' . json_encode($ret_obj_place) . ';';
echo 'parent.parsePlaceFrame()'; 
echo '</script>';

Then, in your second javascript excerpt:

var ge1 = iFrameOF.contentWindow['result1'];      //
var ge2 = iFrameOF.contentWindow['result2'];      //

Should be

var ge1 = window['result1'];      //
var ge2 = window['result2'];      //

to access the global variables we set with the PHP.