XMLHttpRequest
.");'
- text: يجب أن تستخدم التعليمات البرمجية الخاصة بك الطريقة open
لتهيئة طلب "GET" إلى freeCodeCamp Cat Photo API.
testString: 'assert(code.match(/\.open\(\s*?("|")GET\1\s*?,\s*?("|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g), "Your code should use the open
method to initialize a "GET" request to the freeCodeCamp Cat Photo API.");'
- text: يجب استخدام التعليمات البرمجية ل send
طريقة لإرسال الطلب.
testString: 'assert(code.match(/\.send\(\s*\)/g), "Your code should use the send
method to send the request.");'
- text: يجب أن تحتوي التعليمات البرمجية الخاصة بك على معالج أحداث onload
إلى وظيفة.
testString: 'assert(code.match(/\.onload\s*=\s*function\(\s*?\)\s*?{/g), "Your code should have an onload
event handler set to a function.");'
- text: يجب أن تستخدم التعليمات البرمجية الخاصة بك أسلوب JSON.parse
لتحليل responseText
.
testString: 'assert(code.match(/JSON\.parse\(.*\.responseText\)/g), "Your code should use the JSON.parse
method to parse the responseText
.");'
- text: يجب أن تحصل شفرتك على العنصر مع message
الفصل وتغيير HTML الداخلي إلى سلسلة بيانات JSON.
testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g), "Your code should get the element with class message
and change its inner HTML to the string of JSON data.");'
```
```