When I console log my response all I get back is HTML. How do I get the player object?
Site.JS :
$(".AddToPreRank").click(function (e) {
e.preventDefault();
//grab id
var id = $(this).get(0).id;
//append player to prerank list
$.ajax({
url: '@Url.Action("AddToPreRank")',
type: 'POST',
data: { id : id },
success: function (response) {
console.log(response);
alert("hello");
}
});
});
LeagueController.cs :
[HttpPost]
public ActionResult AddToPreRank(int id){
Player player= new Player();
player = db.Players.Find(id);
return Json(player);
}