Client side script not working

Hey guys, I am trying to call one API, after inserting a lead, but API calling not working, please let me know, whats wrong in my code.

frappe.ui.form.on(‘Lead’, {
after_insert: function(frm) {
// Define the API endpoint URL
var API_ENDPOINT = “https://madhanumkda.us.tempcloudsite.com/mad/index.php?txt_input=ghost”;

    // Prepare the data to be sent to the API endpoint


    // Make a GET request to the API endpoint
    frappe.call({
        method: "crm.crm.doctype.lead.lead.trigger_api_call",
        args: {
         
            api_endpoint: API_ENDPOINT
        },
        callback: function(response) {
            if (response.message) {
                frappe.msgprint("Lead data sent successfully to the API");
            } else {
                frappe.msgprint("Failed to send lead data to the API");
            }
        }
    });
}

});

Hi @madhanumk,

Client script (Form Scripts) hasn’t after_insert event.

Please check the Form Events.

Thank You!