Implementation of a CORS compliant ajax handler