JavaScript cannot call java method directly since it is on the server. You need a Java framework like JSP to call when a request is received from JavaScript. Let’s see how to use JSP to call a Java function inside JavaScript function.
Here’s the JavaScript code:
//javascript code
function initiateFunc() {
$.get('localhost/project/myexecution.jsp);
}
$( initiateFunc); Here’s the JSP code for “myexecution.jsp”:
<%@ page import="deleteconfig"%> <% deleteconfig.initiate(); %>