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

Count results from JSON request

Welcome Robert :)

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

Count results from JSON request

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

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

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

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

Perfect Yurii - thanks a million.

Return to “Issues”