Reputation:
Is it possible to call the controller action in javascript. I tried in the following way but it wont work
$('#members').html({%render(controller('AmvMembersBundle:Pages:EditMembers'))%});
Upvotes: 1
Views: 1673
Reputation: 2488
A better solution in this case is to put the render funciton inside a div, then control its visibility with JS.
<div id="members">
<div class="edit hidden">
{% render(controller('AmvMembersBundle:Pages:EditMembers')) %}
</div>
</div>
<script>
$('#members').find('.edit').removeClass('hidden');
</script>
Although, if you need this to be dynamically called, you should load the controller via AJAX.
Upvotes: 0