--- id: 587d7faf367417b2b2512be9 title: Post Data with the JavaScript XMLHttpRequest Method challengeType: 6 videoUrl: '' localeTitle: نشر البيانات باستخدام طريقة XMLHttpRequest في جافا سكريبت --- ## Description undefined ## Instructions
قم بتحديث الكود لإنشاء وإرسال طلب "POST". ثم أدخل اسمك في مربع الإدخال وانقر على "إرسال رسالة". ستحل وظيفة AJAX محل "الرد من الخادم سيكون هنا". مع رد الخادم. في هذه الحالة ، هو اسمك إلحاق "يحب القطط".
## Tests
```yml tests: - text: '' testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new XMLHttpRequest.");' - text: '' testString: 'assert(code.match(/\.open\(\s*?("|")POST\1\s*?,\s*?url\s*?,\s*?true\s*?\)/g), "Your code should use the open method to initialize a "POST" request to the server.");' - text: '' testString: 'assert(code.match(/\.setRequestHeader\(\s*?("|")Content-Type\1\s*?,\s*?("|")text\/plain\2\s*?\)/g), "Your code should use the setRequestHeader method.");' - text: '' testString: 'assert(code.match(/\.onreadystatechange\s*?=/g), "Your code should have an onreadystatechange event handler set to a function.");' - text: '' testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?.+?\.responseText/g), "Your code should get the element with class message and change its inner HTML to the responseText.");' - text: يجب أن تستخدم التعليمات البرمجية الخاصة بك طريقة send . testString: 'assert(code.match(/\.send\(\s*?userName\s*?\)/g), "Your code should use the send method.");' ```
## Challenge Seed
```html

Cat Friends

Reply from Server will be here

```
## Solution
```js // solution required ```