I have a controller named CustomersInfoAPIController
. I'm using Knock out, webapi2, asp.net mvc5 to build an application. I'm binding the data using knout JS. When I run the application and debug the knockout script, I don't see any error .When I try to insert data using AJAX I see error `"Failed to load resource: the server responded with a status of 500 (Internal Server Error)"
the ajax code is:
$.ajax({
url: '/api/CustomersInfo',
type: 'post',
data: dataObject,
contentType: 'application/json',
success: function (data) {
addCustomerViewModel.customerListViewModel.customers.push(new
Customer(data.Id,data.CustomerName, data.ContactName, data.Address,
data.City, data.PostalCode, data.Country));
self.Id(null);
self.CustomerName('');
self.ContactName('');
self.Address('');
self.City('');
self.PostalCode('');
self.Country('');
}
});