Fix clearing all messages

Attempting to clear all messages results in a JS error preventing the UI from updating itself.

Also the error message displayed when the AJAX call fails is incorrect.