I want to add data to selectbox. But, I got this error ...
"Error: $ (" "). Attr (" value ", guruMapelId) .html is not a function
Source file: http: // localhost: 8084 / controller? Aksi = kurikulum
Line: 5"
this is my js code:
function dataGuruMapelSelect(dataSelect){
$.getJSON("controller", "aksi=dataGuruMapel", function(json){
$.each(json.guruMapelData, function(k,v){
var guruMapelId = v.guruMapelId;
var guruNama = v.guruNama ;
$('<option />').attr('value',guruMapelId).html(guruNama).appendTo(dataSelect);
})
});
}
And this is JSON data
{
"guruMapelData": [
{
"guruMapelId ": "1",
"guruNip ": "1331/001",
"guruNama ": "HARI BUDIYONO DRS.",
"mapelNama ": "PPKn",
"tahunAjarNama ": "2010/2011",
"mapelKategoriNama ": "Normatif",
"mapelId ": "1"
},
{
"guruMapelId ": "2",
"guruNip ": "1331/002",
"guruNama ": "PENI WARDAYANI DRA",
"mapelNama ": "Kewirausahaan",
"tahunAjarNama ": "2010/2011",
"mapelKategoriNama ": "Produktif",
"mapelId ": "2"
}
]
}
What is my fault? Thanks before ...
source
share