I have my own controller for a customer address delete, so at the end of the controller, I send a notification message to notify the user.


        return  $this->resultJsonFactory->create()->setData(['success' => true,'message' => $this->messageManager->addSuccess("Successfully deleted customer address")]);

    } catch(\Exception $e) {

        return  $this->resultJsonFactory->create()->setData(['success' => false,'message' => $this->messageManager->addError('Address cannot be deleted')]);


and at the success of ajax call I reload the page and after reloading the message should display on the UI.

 success: function (data) {

But the issue is notification message is displayed before the reload, and after the reload the message stays(which I want).

The issue is the message gets displayed as soon as i do this

return  $this->resultJsonFactory->create()->setData(['success' => true,'message' => $this->messageManager->addSuccess("Successfully deleted customer address")])

I want to show the message after reloading the page, how can I achieve that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.