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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -