Hi all,

first of all, excuse me for my terrible English.

I'm a cake newbie and I need a little help understanding the ajax
rendering.

Using Fiddler I see that after an "ajax update" a lot of useless stuff
is sent to the client.

I'using the following pattern:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

/* ~ index.thtml ~ */
$ajax->div("divT");
// div1 contents
// for example, a table with a 'Delete' link entry like
// $ajax->link('Delete', "delact/{$id}", array('update'=>'divT'));
// which delete the current row
$ajax->divEnd("divT");

// view other contents...


/* ~ controller (part of) ~ */

function delact($id)
{
        // leave out all various checks

        // Controller uses the 'RequestHandler' component
        // and 'Html', 'Javascript', 'Ajax' helpers

        $this->RequestHandler->setAjax($this);

        $this->Entity->del($id);

        $this->set(*table contents/rows with an Entity->findAll(...) query*)

        $this->render('index');
}

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

This code returns to the client the HTML table, in the javascript
__ajaxUpdater__ variable, and ALL of the contents that follow the
'divT' div.
So, if div is followed by 10Kb of HTML, all this markup is sent.

Using the $this->render('index', 'ajax') instead of setAjax($this)
give the same results.

Is this pattern wrong? Is there a most efficient way to send ajax
content to the browser?


Thanks.

Riccardo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to