Jump to content

Can $page->message() be invoked by javascript?


Marc
 Share

Recommended Posts

I'm working on an admin module and I'm using the build in notification system for messages, errors and warnings, which works great. Some of my forms are handled by ajax however, and it would be nice if there was a javascript equivalent of $page->message("hi there"), like there is for the SystemNotifications module. (Which works like Notifications.message("Message to send").) I currently have a custom notification system for ajax in place, but it would be nice if I could use something purely PW. Can this be done?

Link to comment
Share on other sites

How about this in the execute function?

if($this->config->ajax && $this->input->post->message){
  $this->message($this->input->post->message);
  return;
}

Well yeah, that's the PHP part of the ajax function, but to display the actual message without refreshing the page some javascript magic will have to happen. I'm sorry if I didn't make myself clear, but the real question is: is there a build in javascript function I can use to display these messages? I would like to use that instead of my custom functionality if possible. Like there is for the SystemNotifications module, as Ryan explains here. I tried that module but for my purposes it's not the right fit.

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...