Link to home
Start Free TrialLog in
Avatar of Techsavy
Techsavy

asked on

Ajax Help

Hi,

I am using following JQuery function to make an async call to SharePoint list data and return the count. However, when i run this function, I get data.d.results.length is not defined.

 function GetActionLogItems(result) {
           
            var violationCount = 0;

            $.ajax({

                url: "/_vti_bin/listdata.svc/ActionLog?$filter=((PropertyIDId%20eq%20" + result.Id + ")%20and%20(ActionTypeId%20eq%203))",
                asynch: false,
                success: function (data) {

                    violationCount = data.d.results.length;

                }

            });


            return violationCount;

        }

Please help, What i want from this function is the number of items returned from my Ajax call.
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

can you tell us the value of 'data' by alerting the same?
ASKER CERTIFIED SOLUTION
Avatar of Bardobrave
Bardobrave
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial