I want to store these information into my list called QuizList.

I have the following code:

var dtm = new Date();

var itemCreateInfo = new SP.ListItemCreationInformation();

var listItem = resultList.addItem(itemCreateInfo);

    listItem.set_item("Student", UserName);
    listItem.set_item("TestDate", dtm);
    listItem.set_item("Score", (score / testQuestions) * 100);
    listItem.set_item("QuizID", currentQuizItem.get_id());
 context.executeQueryAsync(function () {
        $('#TestUI').fadeOut(500, function () { $('#TestReport').fadeIn(500, null)

How can I save these information into my QuizList? Any suggestion?


Your code seems correct to me. If it's not working it should be because the variable "resultList" doesn't point to the list you want.

This line should be before the code you posted above:

var resultList = context.get_web().get_lists().getByTitle('QuizList');
  • this code works perfectly with this code i have the result goes into an report but i wanted to store these information into a list so this line of code you wrote need to be on top of function? – Nderon Hyseni Nov 12 '15 at 9:58
  • Yeah if you modify the code so resultList points to the QuizList as mentioned it should work immediately – FSeidl Nov 12 '15 at 10:03
  • how can I point ti QuizList please could you tell me – Nderon Hyseni Nov 12 '15 at 10:08
  • i modified the code but it is not working – Nderon Hyseni Nov 12 '15 at 10:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.