<script>
$.post("api.php", {action: 'check_login'}, function (response) {
if (response.status == 'success') {
$('#loginForm').hide();
$('#loginHeader').text('You are already logged in.');
setTimeout(function () {
alert('You will now be redirected.');
$(window.location).attr("href", "http://example.com");
}, 3000);
}
}, "JSON");
</script>
The above jQuery script POSTs this request to a php script in the same folder:
POST http://localhost:63342/100D100/api.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
Referer: http://localhost:63342/100D100/login.html?_ijt=taksdipisi3m6dq085nom202e2
Accept-Language: it-IT
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Content-Length: 18
Host: localhost:63342
Connection: Keep-Alive
Pragma: no-cache
Cookie: Phpstorm-b9495478=581c317c-7b73-4419-92d8-ab238525aac4
action=check_login
It works on a normal server, but fails with a 404 when using PhpStorm's integrated server:
HTTP/1.1 404 Not Found
content-type: text/html
content-length: 148
server: PhpStorm 2016.3.2
date: Tue, 10 Jan 2017 14:19:21 GMT
X-Frame-Options: SameOrigin
X-Content-Type-Options: nosniff
x-xss-protection: 1; mode=block
<!doctype html><title>404 Not Found</title><h1 style="text-align: center">404 Not Found</h1><hr/><p style="text-align: center">PhpStorm 2016.3.2</p>
The file is definitely there. What can I try to resolve this issue?