I need to save the record in the database. I have been doing this thing but I don't know for what reason it is giving me this error. Any help will be appreciated. I don't know why the data is null. Please refer to the error show in below screenshot:
data is not defined
function submit(amount) {
var _url = ' /Home/SaveDepositedAmount';
console.log(_url);
$.ajax({
type: "POST",
async: false,
cache: false,
beforeSend: function () { ShowLoading(); },
url: _url,
processData: false,
contentType: false,
dataType: 'json',
data: { amount: amount },
})
.done(function (data) {
Server side code is:
[HttpPost]
public JsonResult SaveDepositedAmount(int amount)
{
JsonResult result = new JsonResult();
int userId = Authentication.Instance.User.UserId;
result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
}