MDL-44342 rest.php should return success information

Javascript should handle properly errors, also, the eye and spinner
should be synchronized with the remote operation