Fetching in javascript with absolute url and relative url
问题 I have a script that I run on my local server and that fetches a php file (on the local server too). If I write the url to fetch as a relative path, I get the file without problems, but, if I add the 127.0.0.1/mypath/myFile, I get a 403 error. function localServerCall() { var urlLocalServer = '127.0.0.1:8000/mypath/myfile.php'; //var urlLocalServer = 'myfile.php'; //THIS WORKS! fetch(urlLocalServer).then(function(response) { console.log(response.json); return response.json(); }).then(function