Xhr connection and web server handler