error in display "mod_quiz_get_attempt_data" result

error in display "mod_quiz_get_attempt_data" result

بذریعہ Masoud Vafaei -
جوابات کی تعداد: 4

Hi All

I'm trying to develop an external client for quiz module. 

and use mod_quiz_get_attempt_data to fetch quiz question. when I want to show the result in HTML view, faced with the attached error.


Uncaught ReferenceError: M is not defined

Uncaught ReferenceError: Y is not defined


can anyone help me?

thanks a lot

منسلکہ err.JPG
درجہ بندی کا اوسط: -
Masoud Vafaei کے جواب میں

Re: error in display "mod_quiz_get_attempt_data" result

بذریعہ Shamim Rezaie -
Core developers کی تصویر Moodle HQ کی تصویر Peer reviewers کی تصویر Plugin developers کی تصویر Testers کی تصویر Translators کی تصویر

Hi Masoud,

Please post the full response you receive after calling mod_quiz_get_attempt_data.

Shamim Rezaie کے جواب میں

Re: error in display "mod_quiz_get_attempt_data" result

بذریعہ Masoud Vafaei -

Hi 

result file has been attached. 

Masoud Vafaei کے جواب میں

Re: error in display "mod_quiz_get_attempt_data" result

بذریعہ Shamim Rezaie -
Core developers کی تصویر Moodle HQ کی تصویر Peer reviewers کی تصویر Plugin developers کی تصویر Testers کی تصویر Translators کی تصویر

The html bit that mod_quiz_get_attempt_data returns is just the bit that is for the questions of the quiz. It's not a complete html document. You need to add <html></html>, <head></head> and <body></body> pairs to that to build a complete html document.

Here is what you can do. Using your browser, go the quiz page and then view the page source (html code). Using the generated html you see there, create an html document like below:

<html>
<head>
<!-- the hole content of the head section -->
</head>
<body>
<!-- load yui-moodlesimple.js and javascript-static.js scripts -->
<!-- the html bit you get from mod_quiz_get_attempt_data -->
</body>
</html>

Shamim Rezaie کے جواب میں

Re: error in display "mod_quiz_get_attempt_data" result

بذریعہ Masoud Vafaei -

thanks for your reply. 


But on the normal quiz page, the generated code similar to the attachment is also generated. The main question is: how can we generate that js code and use in our app?


اما در صفحه معمولی آزمون علاوه بر دو فایلی که شما فرمودید، کد تولید شده ای (generated code ) مشابه فایل پیوست نیز تولید می شود. سوال اصلی این است با چه مکانیزمی می شود این کد را تولید کرد. 

این کد حاصل خروجی تابعی به نام get_head_code است. ,ولی نحوه استفاده از ان در وب سرویس رو نمی دونم. 

با تشکر