请告诉我如何在 .each(function(){}) 中动态填充数组以将其带到这种形式:
var Coord = [[-123.77252789, 44.37857221], [-123.27252789, 44.17857221]];
我试过这个,但结果不同:
$.ajax({
async: true,
type: 'POST',
url: '/Controller/Method',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var Coord=[];
$(data).each(function () {
Coord.push([this.x, this.y]);
});
}
});
了解: