⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. Very soon this forum will be read-only and archived. ⚠

$crud->callbackAfterInsert Redirect

Redirecting Grocery Crud 2 inside callbackAfterInsert

  • Please log in to reply
No replies to this topic

#1 agustin



  • Members
  • Pip
  • 1 posts

Posted 27 February 2021 - 12:15 AM

Hi! I'm having a problem with redirecting in grocery Crud 2 : I know that in grocery crud: callback_after_insert  I can excecute $this->crud->setLangString('insert_success_message',$data);

but in here the variable $this->crud or just $crud is unknown, so I can´t make the redirection. Others things that I've tried:


*return header("Location: ".$link );    (this one just doesnt redirect me, just excecute the save and go back to list like if the redirection weren´t there )

*return redirect()->to($link );                   (same that return header)


I'll apreciate some help  :D!!!





        $crud->callbackAfterInsert(function ($stateParameters
            $link = base_url()."/PuntoVenta/carrito";
            $data = "Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the another page.";
            $data .= "<script type='text/javascript'> window.location = '" . $link . "';</script><div style='display:none'></div>";
            return $stateParameters;


Also tagged with one or more of these keywords: Redirecting Grocery Crud 2, inside, callbackAfterInsert

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users