I have a json array which looks like this
[{
"": "Select your State/Region"
}, {
"BAL": "Balkh"
}, {
"BAM": "Bamian"
}]
I am trying to get the values out of it using jquery, but i can't seem to loop through.
This is what I've tried
var value = $(this).val();
var url = '{{ route('getstatesjson') }}';
$.getJSON(url, { state: value }, function(obj) {
for (var i = 0, len = obj.length; i < len; i++) {
}
});
but i can't seem to pull any of the objects out. The idea is that i can use the first value as the value and the second value as the text in the select.