The ability to use relative URLs in Web pages often means that we can use the local file system to develop and test HTML and avoid unnecessary deployment of Web servers.
However, this is usually not possible when using XMLHttpRequest for AJAX programming.
the XMLHttpRequest is used to work with HTTP and HTTPS protocols . Theoretically, it can work with other protocols such as FTP, but some APIs, such as request methods and response status codes, are specific to HTTP. If you load a Web page from a local file, the scripts in that Web page will not be able to use XMLHttpRequest with relative URLs, because these URLs will be relative to File://URL instead of Http://URL. The same- origin policy usually prevents the use of absolute http://URL. The result is that when using XMLHttpRequest, it is often necessary to upload files to the Web server or run a local server in order to test them.
Ajax-xmlhttprequest and Local files