Count results from JSON request

This forum contains topics that were moved from Get Satisfaction
Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Count results from JSON request

Post by Kateryna Grynko »

Welcome Robert :)

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Count results from JSON request

Post by RobertJay »

In now trying to expand my new knowledge into the Complete event (as opposed to the Success event), I'm trying to use both the jqXHR and textStatus params -- as well as e.g. jqXHR.responseText -- in different ways to get a count as well as the value of a specific record index. Is there a way of doing it as easily as the data structure does it for the Success event. Thanks very much.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Count results from JSON request

Post by Kateryna Grynko »

Dear Robert,

Let's output jqXHR to console to see what is returned.

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Count results from JSON request

Post by RobertJay »

Thank you so much. Here it is: http://screencast.com/t/A0kpbP62

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Count results from JSON request

Post by Yurii Orishchuk »

Hi Robert,

here is code to get "data" object in "complete" event like in success event.

Note: it works only with JSON response.

pre

var data = JSON.parse(jqXHR.responseText);

console.log(data.length);

/pre

Regards.

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Count results from JSON request

Post by RobertJay »

Perfect Yurii - thanks a million.

Post Reply