c# - Returning 2 Json lists and accessing the data? -


i'm returning 2 lists so:

return json(new { firstlist = alllocations, secondlist = openinghours }, jsonrequestbehavior.allowget); 

but when try , access data being returned, getting no values

        success: function (data) {             (index = 0; index < data.length; ++index) {                 console.log(data[index].firstlist.locationname); 

any great

i assume you're trying concatenate 2 different json objects one? if that's case, need deserialize individual objects first, combine them new json object.

return jsonconvert.serializeobject(new [] {jsonconvert.deserializeobject(firstlist), jsonconvert.deserializeobject(secondlist)}) 

this should point in right direction.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

wso2esb - How to concatenate JSON array values in WSO2 ESB? -