xhr request works.
Split functionality into class.
xhr for checking duplicate names. Tests.
Added some phpunit tests.