شرح صفوف ومحتوى الفقرة
- تحتوي الخاصية "readyState " علي الحالة الخاصة بال object التالي "XMLHttpRequest"
- تستخدم الخاصية "onreadystatechange" في تنفيذ الدالة التي تم تمريرها ك callback عندما يحدث تغير في ال "readyState"
- الخاصية "statues" والخاصية "statusText " يستخدمان في تحديد حالة "XMLHttpRequest "
| cell 1 | cell |
| cell 1 | cell |
| cell 1 | cell |
| cell 1 | cell |
| cell 1 | cell |
HTML
function loadDoc() {
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "/files/ajax.txt");
xhttp.send();
}