I'm trying to call JavaScript in a JavaFx WebView from Java, but I get:
Exception in thread "JavaFX Application Thread" netscape.javascript.JSException: TypeError: undefined is not a function at com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:128) at com.sun.webkit.WebPage.twkExecuteScript(Native Method) at com.sun.webkit.WebPage.executeScript(WebPage.java:1439) at javafx.scene.web.WebEngine.executeScript(WebEngine.java:982)
.java file
private WebView emailSubject() {
    String pageURL = "D:myproject\\src\\resources\\WEB_INF\\forms\\readMail\\emailBody.html";
    pageURL = pageURL.replace("\\", "/");
    webView = new WebView();
    webView.setMaxHeight(52);
    webEngine = webView.getEngine();
    emailSubject = getHTMLMailSubject();
    webEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
        if (newState == State.SUCCEEDED) {
            webEngine.executeScript("testCheckMate(\"" + emailSubject + "\");");
        }
    });
    webEngine.load("file:" + pageURL);
    return webView;
}
Exception which points to this line:
webEngine.executeScript("testCheckMate(\"" + emailSubject + "\");");
The HTML:
<!-- Latest compiled and minified JavaScript -->
<script src="../../baseJS/JQuery/jquery-1.11.3.js"></script>
<script src="../../baseJS/JQuery/jquery.min.js"></script>
<div class="panel panel-success">
    <div class="panel-heading">
        <h3 class="panel-title">Home Alone</h3>
    </div>
</div>
<script>
    $(document).ready(function() {
        window.testCheckMate = function (data) {
            $(".panel-title" ).append(data);
        };
    });     
</script>
What am I doing wrong? Thank you all in advance.
Please note that I've tried:
load(); already 
$(".panel-title" ).load(data);
as well as with
testCheckMate outside $(document).ready(function(), but still nothing.
testCheckMate = function (data) {
    $(".panel-title" ).load(data);
};
 
    