i have the following code: (simplified for readability)
CSHARP:
foreach(DataRow dRow in myDS.Tables[0].Rows){
Company myCompany = new Company();
myCompany.id = int.Parse(dRow["id"].ToString());
Companies.Add(myCompany);
}
JavaScriptSerializer serializer = new JavaScriptSerializer();
Response.Write(serializer.Serialize(Companies));
Response.End();
JQUERY:
$ .getJSON('ajax.aspx?what=' + $ ('input[name="what"]').val() + '&where=' + $ ('input[name="what"]').val(), function (data) {
$ .each(data, function (key, val) {
var myCompany = new function () {
this.id = val.id;
}
Companies.push(myCompany);
});
});
now, i have another object in the CSHARP code, which is named Cities
and i would like to return it in the same request.
something like
Response.Write(serializer.Serialize(Companies));
Response.Write(serializer.Serialize(Cities));
Response.End()
and offcourse parse it on the Client side.
how can i do something like that?