Jump to content

Intercept Page->Save from Javascript?


theo
 Share

Recommended Posts

Hello

Is there a way for a module to get an event via JS/JQuery when (actually before) a Page is saved?

For example for showing an alert like "There are unsaved changes" or saving these changes automatically (Ajax)?

Thank you.

Link to comment
Share on other sites

Yes, that's PHP, but you can also inject JS in a hook with

$js = "<script>your script here...</script>";
$event->return = str_replace("</body>", "{$js}</body>", $event->return);

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Hey there, @theo! Just wanted to notify you that I'm moving this topic to the "Module/Plugin Development" subforum.

The "Modules/Plugins" forum area is where support boards for existing modules live, while all module development related topics belong to the "Module/Plugin Development" subforum. Thanks, and sorry for the disturbance ?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...