-2

I have a result from Fiddler (please see the attached image), how can I get the results where the arrow is pointing to? This is what I have done so far and thank you:

arrow

function GetRefiners() {
    $.ajax({
    url: "myUrl",
    type: "GET",
    headers: {
        "accept": "application/json;odata=verbose",
    },
        success: function(data){
            $.each(data.d.query, function(list){
        });
   },
       error: function(error){
           alert("Error message\n" + JSON.stringify(error));
      }
    }
  );

}

deceze
  • 510,633
  • 85
  • 743
  • 889
Ado
  • 65
  • 9

1 Answers1

0

Simply go to the results objects and iterates over it

function GetRefiners() {
    $.ajax({
    url: "myUrl",
    type: "GET",
    headers: {
        "accept": "application/json;odata=verbose",
    },
        success: function(data){
            $.each(data.d.query.PrimaryQueryResult.RefinementResults.Refiners.results.Entries.results, function(list){
                callWhatYouNeed();
           }
        };
   },
       error: function(error){
           alert("Error message\n" + JSON.stringify(error));
      }
    }
  );
}
Weedoze
  • 13,683
  • 1
  • 33
  • 63
  • Thank you I tried but the error function is called (I get error) – Ado Aug 26 '16 at 08:52
  • Please read your question... Is it clear for you ? Did you say that there is an error or did you ask to get the results ? – Weedoze Aug 26 '16 at 08:56
  • If the error function is called it is due to your ajax call. Please provide the error – Weedoze Aug 26 '16 at 09:00
  • The error is: {"readyState":0,"responseText":"","status":0,"statusText":"error"} – Ado Aug 26 '16 at 09:04
  • As I said this is an error linked to your ajax... Your question was very badly explained Check http://stackoverflow.com/questions/19395354/jquery-ajax-readystate-0-responsetext-status-0-statustext-error – Weedoze Aug 26 '16 at 09:06
  • My question was how to get the results. Then I tried your solution and I get the error. What we are talking about? – Ado Aug 26 '16 at 09:09
  • Just call your ajax without anything inside success. Are your sure that your ajax call is working ? – Weedoze Aug 26 '16 at 09:15
  • if you mean the url request, yes... I used in Fiddelr to get the result. I called the with empty success and still get error. – Ado Aug 26 '16 at 09:18
  • debug and see if it gets inside the success function – Weedoze Aug 26 '16 at 09:18
  • Then its not a problem about what I wrote but about the AJAX call – Weedoze Aug 26 '16 at 09:23
  • Ok it's solved, seems like doesn't like localhost, I need to specify the host name. Thank you! :-) – Ado Aug 26 '16 at 09:30
  • No problem ! Have fun – Weedoze Aug 26 '16 at 09:34