I have an ajax function that consumes a webservice, and returns me a list, how do I get that list and I mount two arrays with the values?
JS:
function getCars() {
$.ajax({
type: "POST",
url: "CarService.asmx/GetAllCars",
data: "MethodName=GetAllCars",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
//QUERO MONTAR OS ARRAYS AQUI
});
},
failure: function(msg) {
$('#output').text(msg);
}
});
}
I want to get the return of this list and mount two arrays. Ex: the list returns 5 records, with ID, value, and car color. I want to mount two arrays, one for color and another for the value Ex:
var cor = [];
var valor = [];
I want to fill in the 3 records returned in the list, that is, 3 colors and 3 value, getting
cor['red','blue','blue']
valor ['20.5','30.5','50.5']
That's all.