So I usually only deal with server side code, and need some assistance. in c# i was able to just do something like,
numStirng = listItem["fieldName"].toString();
num = Convert.ToInt(num);
listItem["fieldName"] = num + 1;
heres my javascript code
var selectedList = web.get_lists().getByTitle('Easy Poll');
context.load(selectedList);
//var oListItem = selectedList.getItemById(parseInt("1", 10));
var selectedItem = selectedList.getItemById(1);
//selectedItem.get_item("EmployeeName", newName);
selection = $('input[@name="food"]:checked').val();
if(selection == "rubys")
{
num = selectedItem[rubys];
selectedItem[rubys] = num + 1;
}
if(selection == "panda")
{
num = selectedItem[panda];
selectedItem[panda] = num + 1;
}
if(selection == "subway")
{
num = selectedItem[subway];
selectedItem[subway] = num + 1;
}
if(selection == "carls")
{
num = selectedItem[carls];
selectedItem[carls] = num + 1;
}
selectedItem.update();
//selectedList.update();
context.load(selectedItem);
context.executeQueryAsync();
so my questions becoem a)what am I doing wrong? b)is there a good direction i can look to or is this an easy fix, ty.