added error functions to ajax requests to catch unauthorized error
Merge pull request #290 from paczian/master

added error functions to ajax requests to catch unauthorized error