var url="jk.php";var xhr = new XMLHttpRequest();xhr.onreadystatechange = function () { if (xhr.readyState == 4 (xhr.status = 200 xhr.status 400)) { var response = xhr.responseText; console.log("server response:"+response); }};xhr.open("GET"
var url="jk.php"; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) { var response = xhr.responseText; console.log("server response:"+response); } }; xhr.open("GET", url, true); xhr.send();
其实就是原生的js方法。
要想办法引入jq