我有这样的json:
[
{
"MOD_AXL": 0,
"MOD_CDS_ID": 110000168,
"MOD_CV": 0,
"MOD_CV_CTM": null,
"MOD_ID": 168,
"MOD_MFA_ID": 514,
"MOD_PC": 1,
"MOD_PCON_END": 199007,
"MOD_PCON_START": 196303,
"MOD_PC_CTM": null,
"Name": "2 CV"},
{
"MOD_AXL": 0,
"MOD_CDS_ID": 110004500,
"MOD_CV": 0,
"MOD_CV_CTM": null,
"MOD_ID": 4500,
"MOD_MFA_ID": 514,
"MOD_PC": 1,
"MOD_PCON_END": 198810,
"MOD_PCON_START": 197808,
"MOD_PC_CTM": null,
"Name": "ACADIANE"},
{
"MOD_AXL": 0,
"MOD_CDS_ID": 110001660,
"MOD_CV": 0,
"MOD_CV_CTM": null,
"MOD_ID": 1660,
"MOD_MFA_ID": 514,
"MOD_PC": 1,
"MOD_PCON_END": 197712,
"MOD_PCON_START": 196301,
"MOD_PC_CTM": null,
"Name": "AMI"}
// etc..etc..
]
但是如何设置为选择值 MOD_ID,以及选择选项的文本:名称?
我在文本中有这些数据:
$(".man-select").change(function(){
var mfa_id = $(".man-select").val();
console.log(mfa_id);
$.ajax({
url: "/get_models_for_mfa/mfa_id="+mfa_id+".json",
type: "GET",
data: {},
success: function(text) //here is object
{
console.log("getted");
$('.mod-select')
.append($("<option></option>")
.attr("value",text)
.text(text));
},
error: function(){
//alert('Ошибка javascript');
},
dataType : "html"
});
});