Remove the following from the $.ajax call:
contentType: 'application/json; charset=utf-8',
You have specified application/json
encoding but the $('#form-login').serialize()
function is sending application/x-www-form-urlencoded
content.
As far as sending the returnUrl parameter is concerned, you could simply read it from the form action
where it should be present (if you used the Html.BeginForm()
helper):
$.ajax({
url: this.action,
...
});
Also you probably want to rename the event
variable with something else as this is a reserved word in javascript:
$('#form-login').submit(function (e) {
e.preventDefault();
...
});