Topic: Implementing Approval Method Related to AJAX in FA
Hello everybody,
I'm developing a custom module for budgeting usage. There is a approval feature to determine whether the budgeting usage is okay or not.
The problem I faced is I can't hide the approval button after I press the button and the Ajax run. The approval button is still there and I also can't display the notifications.
Here is my snippet codes
if($_POST['approve'])
{
$budget_usage_id = $_POST['budget_usage_id'];
approve_budget_usage($budget_usage_id);
display_notification_centered(_("The Budget usage has been approved.")); // Can't display it
$_POST['approved'] = '1'; // Approved
$Ajax->activate('buttons'); // Should I use ajax here??
}
For display
<p id="buttons" style="text-align: center">
<?php if($_POST['approved'] == '0'): ?> // Cek if the budget is approved or not
<?php submit('approve', _("Approve"), true, '', 'default'); ?>
<?php endif; ?>
</p>
I'm still curious about it even though I can use JQuery for it but it could be great if I can use Ajax from FA.
Thanks.