Getting Variables from LMS using JavaScript


Can anyone check my file and tell me if there is any bug. What am trying to do is to get info like name and email id from Moodle into the file that am building. Am able to get name using "FullName" variable in my file. But am not able to get email id. Whats happening here is when i type "StuID" into javascript, it automatically changes to "StuId" when saved. Thus am not able to get the email id value from Moodle. My question is why does it automatically change in JavaScript.

So now once i publish the file, i go to user.js file and change the script manually and upload in Moodle and it works perfectly. Can someone tell me what is the way to overcome this problem. 

2 Replies