Customize users frontend forms messages

3.84K viewsCore
0

Hello,

I would like to add Errors or Success messages to the page when users change their informations on their profile page (in addition of ap-notify system). I’ve tried to use this jQuery hook ‘ap_after_ajax’, but it do nothing :

$(document).on('ap_after_ajax', function(e, data) {
  // It do nothing
  console.log('ap_after_ajax');
});

How can I customize my errors or success messages for user sections forms ?

Thank you!

0

Yes, I know for the data object. This is a bad example. The problem is I didnt find how to call a function after the Ajax is finish. The hook ap_after_ajax is never called ?

0

Oh sorry, this is not for translating the form success/errors messages. I want to append another box on top of the form after the Ajax is finish. I need to have an event when Ajax is finish and get the success or the error message to append it in this new box.

Example :

$(document).on('ap_after_ajax', function(e, data) {
  var message = data;
  $('#ap_user_profile_form').prepend('<div class="msg">'+message+'</div>');
});

How could achieve this ?

Thanks! 🙂

commented on answer

Data is Object so you cannot directly interpolate it. if you want message then use: data.message