I searched this error and tried other people`s solution but it does not fixed.I changed jquery versions , write code from beginning vs vs but still same.
[HttpPost]
public JsonResult GetID(int ID)
{
List<User> users = db.users.ToList();
User user = users.FirstOrDefault(x => x.Id == ID);
return Json(user, JsonRequestBehavior.AllowGet);
}
<button onclick="dataget()" id="personID" style="margin-left: 28%;"> <span class="fa fa-arrow-left text-dark" style="font-size:30px" aria-hidden="true"></span></button>
<script type="text/javascript">
var dataget = function () {
var ID = 1;
$.ajax({
url: '/Finder/GetID/' + ID,
type: 'POST',
dataType: 'json',
success: function (data) {
$("#Name").html(data.Name);
$("#Surname").html(data.Surname);
}
});
</script>