Adding javascript and css libraries for a doctype using custom script

@schilgod

is the correct way to use jQuery to include JS libraries ?

frappe.ui.form.on(“Lead”, {
refresh: function (frm) {
var all_data = ;
var data = ;
$.getScript(‘//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js’, function () {
frappe.call({
method: “frappe.client.get_list”,
args: {
doctype: “Risk Profile”,
fields: [‘*’],
filters: {
lead: frm.doc.name,
},
order_by: ‘name’
},
callback: function (r) {
data = r.message;
var options = data[0];
all_data = Array.from(Object.keys(options), k => options[k]);
console.log(all_data);
var headhtml = “

”;
$(“[data-fieldname=‘risk_profile’]”).html(headhtml);
}
});
$(document).ready(function () {
$(‘#dell’).DataTable({
ajax: all_data
});
});
});
}
});

Name