我想使用動態變量作爲動態javascript函數參數。但它給錯誤作爲未定義的變量。jQuery - 使用變量作爲函數參數
$.ajax({
url: 'get_category_list.php',
dataType: 'JSON',
success: function (data) {
var i = 1;
$.each(data, function() {
var id = this.id;
//console.log(id);
var edit = "<img src='../../dist/img/icon/edit.png' " +
"style='border: 1px solid #999637; " +
"border-radius: 2px' " +
"title='Edit' " +
"onclick='show_edit_form(id)'>";
catTable.row.add([
i++,
this.name,
this.level,
this.create_date,
edit
]).draw();
});
}
});
請告訴我這裏有什麼確切的問題?
如果你至少告訴我們是什麼問題,它是在哪一行,我們就知道從哪裏開始? – adeneo
哪個變量?哪個錯誤? – Bergi
確切的問題是,你的問題不清楚 – Weedoze