我使用Ratchet 2來構建應用程序。我試圖做一個簡單的Ajax調用,當我點擊我的按鈕火災tryLogin()
Ajax調用很好地執行,但重新加載頁面得到像這樣Ajax request without push.js
function tryLogin() {
var hxr;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.open("POST", "absolutePathToMyScript");
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
var obj = JSON.parse(xhr.responseText);
console.log(obj);
//spinner.classList.remove("active");
}
}
var data = {
login: document.querySelector('#loginForm input[name="login"]').value,
pwd: document.querySelector('#loginForm input[name="pwd"]').value
};
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("login=" + data.login + "&pwd=" + data.pwd);
}
的響應。 我認爲它是從push.js
有沒有解決方案忽略ajax調用push.js?