javascript - AJax JSON Call error when trying to access the properties of class -


i making json call web method defined in code behind. web method returns class object.the class returns 3 properties 1 of type list , 2 integers. accessing these in following manner:

success: function(result) {                     alert(result);                     alert(result.lookcount);                     alert(result.length);                     if(result.lookcount  > 0)                     {                         var info = "";                          for(var = 0;i < result.lookups.length; i++)                         {                            info += createlookupgrid(result.lookups[i].client,result.lookups[i].clientorg);                         } 

alert(result.lookcount) -> alerts undefined , when alert result shows me compelte result string has data. data returned correctly web method. unable access it.

you need convert result string object. if you're using latest version of jquery, can use parsejson method:

var data= $.parsejson(result); if (data.lookcount > 0) {     ... } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -