javasript invoking custom module to update user response I have created Multiple choice questions in drupal . One node (page ) has one mcq . The answers are displayed by simple radio buttons and javascript . 
Now  I am planing to give some dynamic behavior to users . When a user click the wrong option , I want to capture the response in a custom table in drupal , having userid , nodeid . 
can I invoke a custom module by the present javascript  which gets the userid and nid and update the table . I did some  research , and found that form hook is the way to do such things ,But i have hard time understanding this. Can someone please give me right direction . 

Thanks a ton !
So, lets start from the top.

You have a table with userid, nodeid, responseid declared in a hook_schema. This will create the table.

Then, you declare with hook_menu a callback to capture incorrect values and db_insert them into the table.

Then, on the form page with the multiple choice, you extend the behaviour that if the answer is incorrect upon click, it makes an ajax request with the item selected and the node id to the callback, and the callback will determine the user from the current user session, and store it in the table.

So for the content type, you will probably have a multifield for the potential answers, and a single field with the relative id for the correct answer. So if the content creator creates five answers, and the first item is the correct item, a hook form alter will need to extract and #attach the correct answer so that the behaviour on the page can pick it up, use it to determine which of the items is the correct one, extract the field id of the incorrect items and then ping it to the server.