How to do a Full Page Reload After Delete or Update For GroceryCRUD Enterprise Version: 2.7.9?

Does anyone know how to do a full page reload for GroceryCRUD Enterprise Version: 2.7.9?

I have tried the following:

  1. Use of header(“Location:”)
  2. Use of redirect(“controller/functionname”)
  3. Use of echo to add javascript that reloads the page:
    echo '<script>

Thank you in advance!

Hello @larasmith ,

The code that you are trying to apply it is blocked by the JavaScript that we use as this can cause XSS attacks. On the other side, you can use the JavaScript callbacks that we have here: unsetAutoloadJavaScript | Grocery CRUD

For example:

$(document).ready(function () {
        callbackAfterUpdate: function (currentForm) {
            window.location = 'http://mysite/somepage.php';

Please keep in mind that if you upgrade to the latest Grocery CRUD Enterprise, you can also use the RedirectResponse class as per documentation here: Full Page Redirection | Grocery CRUD


1 Like

Thank you for this response :blush:
I was not able to apply it though because I already have a workaround:

      $crud->callbackAfterInsert(function ($stateParameters) {

          $msg = '<script>
                    $(document).ready(function () {

          return (new \GroceryCrud\Core\Error\ErrorMessage())->setMessage($msg);

In the script, I hide the container of the error dialog box then triggered the reload.
It’s not proper though but does the work :sweat_smile:

1 Like

Oh god, you literally hacked the system and find something that I haven’t thought :slight_smile:

1 Like