Я получаю ниже ошибка net :: ERR_CONNECTION_REFUSED, я отправляю сообщение в mu PHP, все на одном компьютере.
function f() {
var username = $("#user").val();
var password = $("#pass").val();
var payload = {"username":username,"password":password};
var headers = new Headers({'X-Requested-With': 'XMLHttpRequest'});
var request = $.post("http://localhost:8080/prosveta_projekat/ministarstvo/login.php",payload);
request.setRequestHeader("Content-type", "application/json");
request.setRequestHeader("X-Requested-With","XMLHttpRequest");
request.done(function () {
var token = headers.get("Authorization");
localStorage.setItem("token",token);
}).fail(function () {
console.log("error");
});
}