javascript - How to pass variable inside a variable? -
in datatable creation want pass variable in rendering of column :
"aocolumndefs": [ { "atargets": [ 2 ], "bsortable": false }, { "atargets": [ 2 ], "bsearchable": false }, { "atargets": [ 2 ], "mrender": function ( data, type, full ) { var url_ = full[1]; return '<div style="text-align: center;">'+ '<a href="javascript:void(0)" title="télécharger" onclick="telecharge("'+url_+'")">'+ '<button class="btn btn-mini"><i class="icon-download-alt"></i></button>'+ '</a>'+ '</div>'; } } ]
at runtime error , how pass variable url_
?
you need nest quotes , need escape inner quotes.
'<a onclick="telecharge(\''+url_+'\')">'
Comments
Post a Comment