function sendAjax(final, xhttp, checkedAnnotation) {
    xhttp.open('POST', '/markdown');
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    var ann = '';
    if (checkedAnnotation.length > 0) { // convert list of annotations to string
        ann = checkedAnnotation[0];
        for (var i = 1; i < checkedAnnotation.length; i++) {
            ann += ',,,' + checkedAnnotation[i];
        }
    }
    xhttp.send(
        "data=" + encodeURIComponent(document.getElementById('editor').value) +
        "&final=" + final +
        '&annotations=' + ann
    );
}
/**
 * Send ajax request to server.
 * @param final if i want final preview or not.
 * @param xhttp XML http request
 * @param checkedAnnotation list of annotation which will be deleted from final preview
 */
Send ajax request to server.
@param final if i want final preview or not.
@param xhttp XML http request
@param checkedAnnotation list of annotation which will be deleted from final preview
Send ajax request to server . @param final if i want final preview or not . @param xhttp XML http request @param checkedAnnotation list of annotation which will be deleted from final preview
function sendAjax(final, xhttp, checkedAnnotation) {
    xhttp.open('POST', '/markdown');
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    var ann = '';
    if (checkedAnnotation.length > 0) { 
        ann = checkedAnnotation[0];
        for (var i = 1; i < checkedAnnotation.length; i++) {
            ann += ',,,' + checkedAnnotation[i];
        }
    }
    xhttp.send(
        "data=" + encodeURIComponent(document.getElementById('editor').value) +
        "&final=" + final +
        '&annotations=' + ann
    );
}
function sendAjax ( final , xhttp , checkedAnnotation ) { xhttp . open ( 'POST' , '/markdown' ) ; xhttp . setRequestHeader ( "Content-type" , "application/x-www-form-urlencoded" ) ; var ann = '' ; if ( checkedAnnotation . length > 0 ) { ann = checkedAnnotation [ 0 ] ; for ( var i = 1 ; i < checkedAnnotation . length ; i ++ ) { ann += ',,,' + checkedAnnotation [ i ] ; } } xhttp . send ( "data=" + encodeURIComponent ( document . getElementById ( 'editor' ) . value ) + "&final=" + final + '&annotations=' + ann ) ; }
Send ajax request to server.
Send ajax request to server .
// convert list of annotations to string