 
 
													
									AJAX Response
									
									
									
									
									
								
								في هذا الدرس سوف نتعرف علي الخواص Properties التي تستخدم في عملية ال Response
التاريخ
												
											16 نوفمبر 2021
										
										
									الدروس
146
										
									المستوى
											العامة
										
										
									اللغة
																						انجليزي
																					
										
									المشاهدات
1549
										
									المواضيع
24
										
									الشروحات chevron_left AJAX Response chevron_left JavaScript
								
									AJAX Response
								 
																							
						</> Server Response Properties
| Property | Description | 
| responseText | تستخدم في أرجاع البيانات كنص | 
| reponseXML | تستخدم في أرجاع البيانات ك XML | 
</> The responseText Property
تستخدم الخاصية "responseText " في ارجاع استجابة الخادم علي هيئة نصوص
</> The responseXML Property
تقوم خاصية responseXML بإرجاع استجابة الخادم ككائن XML DOM
باستخدام هذه الخاصية ، يمكنك تحليل الاستجابة ككائن XML DOM
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
| Method | Description | 
| getResponseHeader() | تستخدم في ارجاع بيانات من الخادم تخص header معين | 
| getAllResponseHeaders() | من الخادم header تستخدم في ارجاع جميع البيانات الخاصة بال | 
</> The getAllResponseHeaders() Method
تقوم الدالة  getAllResponseHeaders () بأرجاع كافة معلومات header من استجابة الخادم server response 
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
    document.getElementById("demo").innerHTML =
    this.getAllResponseHeaders();
}
xhttp.open("GET", "/files/ajax.txt");
xhttp.send();
																			
									
																		
								</> The getResponseHeader() Method
تستخدم الدالة ( )getResponseHeader في ارجاع بيانات معينة خاصة بال Header من عملية استجابة الخادم server response
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
    document.getElementById("demo").innerHTML =
    this.getResponseHeader("Last-Modified");
}
xhttp.open("GET", "/files/ajax.txt");
xhttp.send();
																			
									
																		
								 
                           CLOSETAG
                            CLOSETAG
                        