I'm sending a List from my ASP.NET WebMethod to my Javascript using this:
List<Person> plist = new List<Person>();
string json = "";
System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
json = oSerializer.Serialize(plist );
return json;
And I'm using this to retrieve these values from my JS:
function onSuccess(val) {
var obj = JSON.parse(val)
obj.forEach(function (entry) {
console.log(entry);
});
}
Everything works well. However now I want to return TWO lists such as:
List<Person> plist = new List<Person>();
List<Car> carlist = new List<Car>();
using the same mechanism I used before. How can I insert two lists to the Serializer and print them from my JS?
Aucun commentaire:
Enregistrer un commentaire