function updateMenu(itemId){
var itemLabel = $('#itemLabel_' + itemId).val();
var itemUrl = $('#itemUrl_' + itemId).val();
var itemIsActive = $('#itemIsActive_' + itemId).val();
var itemDescription = $('#itemDescription_' + itemId).val();
if(!itemIsActive){
itemIsActive = 1;
} else {
itemIsActive = 0;
}
var elem = document.getElementById('itemIsActive_' + itemId);
if (elem && elem.type === 'checkbox') {
itemIsActive = elem.checked ? 1 : 0;
}
var postData = {itemId: itemId, itemLabel: itemLabel, itemUrl: itemUrl,
itemIsActive: itemIsActive, itemDescription:itemDescription};
$.ajax({
type: 'POST',
async: true,
url: "/admin/updatemenu/",
data: postData,
dataType: 'json',
success: function(data){
if(data['success']){
alert(data['message']);
} else {
alert(data['message']);
}
}
});
}