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&eacute;l&eacute;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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -