I'm running C# with MVC in ASP.NET, and I've got an ajax call that's supposed to return a list
of objects, but instead it's just returning the string "System.Collections.Generic.List`1[Namespace.CustomObject]"
Clearly the data is making it back to the javascript, and returning List<int>
doesn't change anything significant, so the object isn't at fault. Did I make a mistake in my ajax call that I've been missing, or do I need to use something other than list
?
My ajax call:
$.ajax({
type: 'POST',
url: url,
data: arrayOfInts
contentType: 'application/json',
datatype: 'json',
success: function (data) {
if (data.length) {
doThisIfDataReturned(data);
} else {
doThisIfNoDataReturned(productIds);
}
}
});
And the method it calls:
public List<CustomObject> MakeAList(int[] productIds)
{
//
// create objectList
//
return objectList; //debugger shows that list is correct here
}