ITS mobile AJAX code for interfacing between the client and server side. More...
ITS mobile AJAX code for interfacing between the client and server side.
[in] | 'id' | new user id |
[in] | 'action' | ITS screen action ('q', 'r', 's', 'm', 'submit', 'skip') |
[in] | 'data' | general purpose data dependent on the action |
[out] | $JSON_array | JSON formatted array containing the output data |
'q':
If set, changes current chapter number.
'r':
If set, review index is incremented if positive, decremented if negative, or reset if 0. If index is out-of-bounds, it will not change.
's':
N/A
'm':
N/A
'submit':
Question id, question type, and user answer delimited by '~'
Question id: question id number
Question type: 'c', 'm', 'mc'
User answer: array of user answers dependent on question type:
'c': Number
'mc': Single uppercase letter
'm': Comma separated uppercase letters in order with respect to the left hand side
'skip':
Question id of question skipped
'ridx_end':
Returned if the review index is manipulated. 1 = reached max index value. -1 = reached min index value.
'Q-feedback':
Returned after a question is submitted. Content depends on question type:
'c':
array[0] = answer, array[1] = tolerance limits
'mc':
Array of percentages of all current term student answers for each answer in order
'm':
Array of scores for each left hand side value in order
'content':
ITS screen content dependent on action:
's':
"Module": Module number
"Scores": Points earned in respective module
"Percentage": Earned points / available points
"Attem": Number of attempted questions
"Avail": Number of available questions
'q':
"Q-type": mc,c,m
"Q-title": Title string
"Q-question": Question string
"Q-answers": Number of total answers
"Q-answers-values": Array of answer values
"Q-image": Image id number
'r':
"Q-type": m,mc,c
"Q-title": Title string
"Q-question": Question string
"Q-answers": Number of total answers
"Q-answers-values": Array of answer values
"Q-image": Image id number
"user_answer": User's submitted answer
"user_score": User's score
'm':
Current active chapter
The client makes AJAX requests to this script. This script calls the ITS_screen_mobile class with the appropriate arguments and returns the data to the client in the JSON format.
A user session must first be created by supplying the user id. In all other AJAX calls the 'id' field should then be obmitted.
First AJAX call example:
Subsquent AJAX call example:
Error codes:
Formatting of documentation is good enough for now.
Session ending / logging off??