Re: Updating two div layers with HTML_Ajax

From: Date: Thu, 19 Jan 2006 15:39:33 +0000
Subject: Re: Updating two div layers with HTML_Ajax
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22608@lists.php.net to get a copy of this message
If you were using HTML_AJAX_Action you would do: function displaySomething($id) { $title = getTitle($id); $body = getBody($id); $response = new HTML_AJAX_Action(); $response->assignAttr('titleId','innerHTML',$title); $response->assignAttr('bodyId','innerHTML',$body); return $response; } -josh Dan Rossi wrote:
function myfunction(foo, bar) { $response = new HTML_AJAX_Action(); //do something with response here return $response; } what if we usually have to return content to display in the layer what happens then ? On 19/01/2006, at 4:01 AM, Joshua Eichorn wrote:
    Dan Rossi wrote:
        On 18/01/2006, at 7:16 PM, Dan Rossi wrote:
            Proxy usage, which way is better ? Im having some
            performance issues with live server it seems pretty slow
            to load, and the message div isnt showing but is on my
            machine. As crap as it is the live server is running PHP
            4.2.2 could this be an issue ?
        Just to confirm not even putting this in the data returning to
        the div layer will work, ideally this would be preferable to
        just write to the title div on the method call.
        <script language="JavaScript">
        document.getElementById('title').innerHTML = 'test';
        </script>
    Script blocks aren't automatically processed when you add them
    with innerHTML. At the moment there is nothing in HTML_AJAX to
    help you would with this, feel free to open a feature request.
    If you return and HTML_AJAX_Action object you can perform a bunch
    of different JS actions see:
    http://htmlajax.org/HTML_AJAX/Using%20haSerializer?
    You can also eval the script blocks after they have been added to
    the dom (This is what a feature request would be for)
    var scripts =
    document.getElementById('title').getElementsByTagName('script');
    for(var i = 0; i < scripts.length; i++) {
    eval(scripts[i].innerHTML);
    }
    -josh
    --     PEAR General Mailing List (http://pear.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.general (#22608) next »