Hi, I have a beginner level Json question with MVC.net (I've never really used jquery or json) so please excuse me if I ask something stupid.
I have a javascript file with the below
<script>
function refreshMovies() {
//$.getJSON("/Home/Refresh", showMovies);
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/Home/Refresh",
success: showMovies
});
}
function showMovies(movie) {
var frag = "<ul>";
frag += "<li>" + movie[0] + " - " + movie[1] + "</li>";
frag += "</ul>";
alert(frag);
$("#divMovies").html(frag);
}
</script>
My Home controller looks like:
public ActionResult Refresh()
{
return Json(GetMovies()); // Method Returns IList<Movies>
}
The question I have is the frag on the alert and when the UL is displayed on the page is always empty.
However, firebug does show that the post request is returning the json, so maybe something is going wrong with showMovies()?