Extract get_message

It will allow to get message when creating AJAX responses instead
manually searching for needed one.