في هذا الدرس 6تصفّح المواضيع
Server Response Properties
Server Response Properties
| Property | Description |
| responseText | تستخدم في أرجاع البيانات كنص |
| reponseXML | تستخدم في أرجاع البيانات ك XML |
The responseText Property
The responseText Property
تستخدم الخاصية "responseText " في ارجاع استجابة الخادم علي هيئة نصوص
Example
The responseXML Property
The responseXML Property
تقوم خاصية responseXML بإرجاع استجابة الخادم ككائن XML DOM
باستخدام هذه الخاصية ، يمكنك تحليل الاستجابة ككائن XML DOM
HTML
const xmlDoc = xhttp.responseXML;
const x = xmlDoc.getElementsByTagName("ARTIST");
let txt = "";
for (let i = 0; i < x.length; i++) {
txt += x[i].childNodes[0].nodeValue + "<br>";
}
document.getElementById("demo").innerHTML = txt;
xhttp.open("GET", "/files/names.xml");
xhttp.send();
Server Response Methods
Server Response Methods
| Method | Description |
| getResponseHeader() | تستخدم في ارجاع بيانات من الخادم تخص header معين |
| getAllResponseHeaders() | من الخادم header تستخدم في ارجاع جميع البيانات الخاصة بال |
The getAllResponseHeaders() Method
The getAllResponseHeaders() Method
تقوم الدالة getAllResponseHeaders () بأرجاع كافة معلومات header من استجابة الخادم server response
HTML
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
document.getElementById("demo").innerHTML =
this.getAllResponseHeaders();
}
xhttp.open("GET", "/files/ajax.txt");
xhttp.send();
The getResponseHeader() Method
The getResponseHeader() Method
تستخدم الدالة ( )getResponseHeader في ارجاع بيانات معينة خاصة بال Header من عملية استجابة الخادم server response
HTML
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
document.getElementById("demo").innerHTML =
this.getResponseHeader("Last-Modified");
}
xhttp.open("GET", "/files/ajax.txt");
xhttp.send();
رحلتك في الدرس
—سجّل الدخول لحفظ تقدمك
تابع إنجاز المواضيع والمصطلحات والمهام، وكمّل من آخر خطوة على أي جهاز.