you can handle that in the frontend codeThose alerts are all based on css class like success, error, warnings etc..one of the approach could be as belowSo based on your http response, set a variable for css class and the messageand based on the variables, display the div in html.