This is the error I get please help.
Object reference not set to an instance of an object."}
HTML CODE
function saveStaffProfile() { var company = new Object(); var staffDetail = new Object(); company.CompanyId = $("#companyId").val(); company.DateJoin = $("#date").val(); company.Department = $("#department").val(); company.JobTitle = $("#jobTilte").val();
staffDetail.StaffId = $("#staffId").val(); staffDetail.StaffNo = $("#staffNo").val(); staffDetail.FName = $("#fName").val(); staffDetail.LName = $("#lName").val(); staffDetail.BirthDate = $("#birthDate").val(); staffDetail.PhoneNo = $("#phone").val(); staffDetail.Email = $("#email").val(); staffDetail.FirstName = $("#firstName").val(); staffDetail.LastName = $("#lastName").val(); staffDetail.PhoneNumb = $("#phonenumber").val(); var data = JSON.stringify({ company: company });
return $.ajax({ contentType: 'application/json; charset=ut-8', dataType: 'json', type: 'POST', url: " /Home/SaveStaff", data: data, success: function (result) { if (result == true) { $("#StaffModal").modal('hide');
}else {
alert("Save Failed!") }
}, error: function () { alert("Error!") }
});
}