I am working on an asp.net core application. I have a form for which I want to make a post request using ajax. The form I am working with is quite large. I don't want to do something like this
var email = $("input[name='email']"); because is really large.
The controller is not receiving any value that the user inputs. It was only null.
I doing like this:
$("#submit").click(function () { $.ajax({ type: "post", url: "/Employee/Create", dataType: 'json', contentType: false, processData: false, data: $("#form1").serialize(), success: function (response) { console.log(response.length); } }); }); #form1 is Id the of the form.
Is there any other method that I can use instead of serialize()? Or I'll have to do var email = $("input[name='email']"); this. Or my code is not in the correct format?
Please help.
https://stackoverflow.com/questions/65568435/unable-to-serialize-asp-dot-net-core-form-using-ajax-request January 05, 2021 at 03:11AM
没有评论:
发表评论