how to show the "content" from a php variable with jquery? (it shows me the "name" itself, not the content in it)
<p>Hmm... i'm trying to use a php variable in jquery, in my edit.php : i'd like to use jquery to show the php variable, using the "rel" attribute, but it gives me the "name" of the variable, not its content. </p>

<p>i'm using php to retrieve the text from the xml file : (edit : one click on submit does not update the text, but 2 clicks do)</p>

<pre><code>/* READ */
$dom = new DomDocument();
$dom-&gt;load('edition.xml');

$_home = $dom-&gt;getElementsByTagName('home')-&gt;item(0);
$home = $_home-&gt;firstChild-&gt;nodeValue;

$_rhizo = $dom-&gt;getElementsByTagName('rhizo')-&gt;item(0);
$rhizo = $_rhizo-&gt;firstChild-&gt;nodeValue;

$_disco = $dom-&gt;getElementsByTagName('disco')-&gt;item(0);
$disco = $_disco-&gt;firstChild-&gt;nodeValue;

/* array */
$rels = array('home' =&gt; $home,
'rhizo' =&gt;$rhizo,
'disco' =&gt;$disco);

echo '&lt;script&gt;var rels = ' . json_encode($rels) . '&lt;/script&gt;';


/* WRITE */
if ( isset($_POST['cache']) ){

    if ( isset($_POST['home']) ){
     $home = stripslashes($_POST['home']);
     $_home-&gt;firstChild-&gt;nodeValue = $home;
    }

    if ( isset($_POST['rhizo']) ){
     $rhizo = stripslashes($_POST['rhizo']);
     $_rhizo-&gt;firstChild-&gt;nodeValue = $rhizo;
    }

    if ( isset($_POST['disco']) ){
     $disco = stripslashes($_POST['disco']);
     $_disco-&gt;firstChild-&gt;nodeValue = $disco;
    }

    $dom-&gt;save('edition.xml');

}
?&gt;
</code></pre>

<p>(the text is simply shown in a textarea, where i just put the php variable)
then i use jquery to show the content from the php variable : (edit with the array object : )</p>

<pre><code>$('#left a').bind('click', function(){

    var text_from_link = $(this).text();

    var rel = $(this).attr('rel');
    $('#textarea1').attr('name', rel);

    $('#textarea1').text(rels[''+rel+'']);//output is "$home" for example, which will retrieve the "home" part from the xml

    return false;
})
</code></pre>

<p>And this works if i double click on submit, if i just click once, the text is not updated... i'm a bit confused with that</p>

<p>Thanks for your help</p>
