从ajax响应中读取[重复]

This question already has answers here:
                </div>
            </div>
                    <div class="grid--cell mb0 mt4">
                        <a href="/questions/4343596/how-can-i-parse-a-json-file-with-php" dir="ltr">How can I parse a JSON file with PHP? [duplicate]</a>
                            <span class="question-originals-answer-count">
                                (16 answers)
                            </span>
                    </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2017-07-11 13:13:48Z" class="relativetime">2 years ago</span>.</div>
        </div>
    </aside>

I receive this as a response from an ajax call. My question is how can I get the values of the object?

{"countries":[{"country_id":730,"country":"El Salvador"},{"country_id":756,"country":"Guatemala"},{"country_id":767,"country":"Indonesia"}]}

my ajax call is this:

$.ajax({
    type: "POST",
    dataType:"json",
    url:getCountriesPackages,
    data: "transferUrl=countries?service_id="+serviceId,
    success: function(data) {

        $.each(data, function(k, v) {
          console.log(k);
        });
    }
});

thank you

</div>

You already have a JSON, you can traverse it using $.each():

var obj = {
  "countries": [{
    "country_id": 730,
    "country": "El Salvador"
  }, {
    "country_id": 756,
    "country": "Guatemala"
  }, {
    "country_id": 767,
    "country": "Indonesia"
  }]
};

$.each(obj, function(k, v) {
  $.each(v, function(kk, kv) {
    console.log("Country ID: " + kv.country_id);
    console.log("Country: " + kv.country);
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

</div>

Your response is a JavaScript object. We access attributes via the dot operator. Our first attribute returned is of type array. You can iterate through the array and access its' attributes for each element.

var response = {"countries":[{"country_id":730,"country":"El Salvador"},{"country_id":756,"country":"Guatemala"},{"country_id":767,"country":"Indonesia"}]};
var countries = response.countries;
for(var i = 0; i < countries.length; i++)
{
    var country_id = countries[i].country_id;
    var country = countries[i].country;
}