We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15001
    • 697 Posts
    Hi,

    I have a web page like this :

    ---------------------
    | vertical | ajaxified |
    | menu | display |
    | | area |
    |___________|___________|


    When the mouse is over one of the vertical menu entries, a summary of the corresponding document is loaded in the ajaxified area.

    When one of the menu entries is clicked, the target document is loaded.

    Because of these 2 possibilities, the ajaxified area initially displays some navigation instructions, which are stored in a TV.

    I want to restore them when the mouse goes out of the vertical menu zone.

    I’m a bit lost in the way to do it as MODx is server-side and Javascript is on the client side.
    <ul id="vertical_menu" 
      onmouseover="javascript: var navInstr='<?php include(\'restore_nav_instr.php\'); ?>';
    document.getElementById('ajaxified_div').innerHTML=navInstr;" >
    <li>first entry</li>
    <li>second entry</li>
    <li>third entry</li>
    </ul>

    and
    restore_nav_instr.php :
    <?php
    $res = $modx->getTemplateVar('NavInstr', "caption");
    $res = $res['value'];
    return $res;
    ?>


    Is this the correct approach ?
    Possible to embed php calls inside Javascript ?
    I could not make it work.

    Thanks for any help.