javascript get hostname of client

Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not? A string containing the domain of the URL. Flags to modify the way the hostname is resolved. Edit: note, if you can it would be better (less HTTP requests) and easier to just include the host name in a dynamically generated