Can't get Data in Controller by Ajax from View in dotnet MVC Core
I am trying to pass data from a view to my controller. I am getting the values in Ajax correctly, but I am unable to pass them to the controller. I get the comment in controller as null always.
Ajax code from view:
Controller code:
I have seen few solutions here in stack overflow but nothing is working for me.
In my project, I am doing this at some point and its working there:
Controller:
1 Reply
I see the problem
your input is a single string, not an object containing a string
but your data...
is an object containing a string with the key "comment"