Symfony - Calling Component Action from Module Action + AJAX
Thursday, May 17, 2012
class newsComponents extends sfComponents
{
public function executeCall()
{
echo $this->id_bna;
return sfView::NONE;
}
}
class newsActions extends sfActions
{
public function executeShow(sfWebRequest $request)
{
$this->renderComponent("news", "call", array('id_bna' => $request->getParameter('id', 0)));
return sfView::NONE;
}
}
// template
<script>
$.ajax({
url: "/news/show",
data: "id=1",
type: "POST"
})
.done(function(data) {
alert(data);
});
</script>
0 comments:
Post a Comment