javascript - Consume a json object , which is basically a list of objects of a class defined in my WCF , in an HTML Win 8 app -



javascript - Consume a json object , which is basically a list of objects of a class defined in my WCF , in an HTML Win 8 app -

so have wcf service returns list of objects of class , has been defined in wcf's contract , supposed receive json object in javascript win 8 app. when

winjs.xhr({ url: url_final }).then(function (r) { var result = json.parse(r.responsetext); document.getelementbyid("greetingoutput").innertext = result; }

i can see [object object] in div , thought how see individual elements on there ?

my class :

public class graphdata { string concerneddate = string.empty; int32 houroftheday = 0; int32 countathour = 0; }

this line:

var result = json.parse(r.responsetext);

makes result javascript object. u can individual properties of object that:

result.concerneddate; result.houroftheday; result.countathour;

i suggest log actual result , see construction of object.

update:

after seeing comment, way access properties be:

var resultsarray = result.getgraphdetailsresult; (var in resultsarray){ var concerneddate = resultsarray[i].concerneddate; var countathour = resultsarray[i].countathour; ... }

javascript html windows-8

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -