function finalPreview(elementID, checkboxes, loadGraph) {
    var editor = document.getElementById('editor').value;
    if (editor.trim().length == 0) { // if editor is empty
        document.getElementById(elementID).innerHTML = "";
    } else {
        var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function () {
            if (xhttp.readyState == 4 && xhttp.status == 200) {
                if (xhttp.responseXML) {
                    var response = xhttp.responseXML.getElementsByTagName('preview')[0].innerHTML;
                } else {
                    response = xhttp.responseText;
                }
                document.getElementById(elementID).innerHTML = response;


                if (loadGraph && loadMermaid) {
                    mermaid.init(undefined, ".mermaid");
                }
            }
        };
        sendAjax("True", xhttp, checkboxes);
        return xhttp;
    }
    return null;
}
/**
 * Using ajax to communicate with server and get final preview of document. Preview is set to {elementID}.
 * @param elementID element where will be final preview.
 * @param checkboxes list of annotation which will be deleted from final preview.
 * @param loadGraph if is true graf will be parsed.
 * @returns {*} XML http request
 */
Using ajax to communicate with server and get final preview of document. Preview is set to {elementID}.
@param elementID element where will be final preview.
@param checkboxes list of annotation which will be deleted from final preview.
@param loadGraph if is true graf will be parsed.
@returns {*} XML http request
Using ajax to communicate with server and get final preview of document . Preview is set to { elementID } . @param elementID element where will be final preview . @param checkboxes list of annotation which will be deleted from final preview . @param loadGraph if is true graf will be parsed . @returns { * } XML http request
function finalPreview(elementID, checkboxes, loadGraph) {
    var editor = document.getElementById('editor').value;
    if (editor.trim().length == 0) { 
        document.getElementById(elementID).innerHTML = "";
    } else {
        var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function () {
            if (xhttp.readyState == 4 && xhttp.status == 200) {
                if (xhttp.responseXML) {
                    var response = xhttp.responseXML.getElementsByTagName('preview')[0].innerHTML;
                } else {
                    response = xhttp.responseText;
                }
                document.getElementById(elementID).innerHTML = response;
                if (loadGraph && loadMermaid) {
                    mermaid.init(undefined, ".mermaid");
                }
            }
        };
        sendAjax("True", xhttp, checkboxes);
        return xhttp;
    }
    return null;
}
function finalPreview ( elementID , checkboxes , loadGraph ) { var editor = document . getElementById ( 'editor' ) . value ; if ( editor . trim ( ) . length == 0 ) { document . getElementById ( elementID ) . innerHTML = "" ; } else { var xhttp = new XMLHttpRequest ( ) ; xhttp . onreadystatechange = function ( ) { if ( xhttp . readyState == 4 && xhttp . status == 200 ) { if ( xhttp . responseXML ) { var response = xhttp . responseXML . getElementsByTagName ( 'preview' ) [ 0 ] . innerHTML ; } else { response = xhttp . responseText ; } document . getElementById ( elementID ) . innerHTML = response ; if ( loadGraph && loadMermaid ) { mermaid . init ( undefined , ".mermaid" ) ; } } } ; sendAjax ( "True" , xhttp , checkboxes ) ; return xhttp ; } return null ; }
Using ajax to communicate with server and get final preview of document.
Using ajax to communicate with server and get final preview of document .
// if editor is empty