I created a function that do an ajax call but I have this error when I call my GetTempData method in C# :
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
This is my code :
function restoreDatas() {
$.ajax({
url: "/AddRecipe/GetTempData",
type: 'GET',
dataType: 'json',
contentType: 'application/json',
cache: false,
processData: false,
success: function (result) {
}
});
}
The C# method called by the ajax call :
public ActionResult GetTempData()
{
return Json(
new
{
title = Session["title"],
cookingTime = Session["cookingTime"],
preparationTime = Session["preparationTime"],
IngredientList = Session["IngredientList"],
ingredientsDescription = Session["ingredientsDescription"],
nbPersons = Session["nbPersons"],
Category = Session["Category"],
difficulty = Session["difficulty"],
nbStars = Session["nbStars"],
file = Session["file"]
}, JsonRequestBehavior.AllowGet
);
}
I don't see where is the problem ?
Do you have any solutions ?
Thank you