Connected frontend and backend

This commit is contained in:
2023-06-06 13:52:39 +02:00
parent b65962247a
commit 79b9a54334
2 changed files with 19 additions and 1 deletions

View File

@@ -135,6 +135,24 @@ function fillDefaultXSLT() {
} )
}
/**
* The `fillDefaultXQuery()` function fetches a default XQuery from the server and sets the value of the element with id "transformArea" to the fetched template.
*
* @function
* @name fillDefaultXQuery
* @kind function
* @returns {void}
*/
function fillDefaultXQuery() {
const serverAddress = window.location.protocol + "//" + window.location.hostname;
fetch(serverAddress + "/assets/samples/sampleXQuery.xquery")
.then( response => response.text() )
.then( (XQueryTemplate) => {
document.getElementById('transformArea').innerText = XQueryTemplate;
highlightSyntax("transformArea");
} )
}
/**
* It sets default content for the element an changes it's color to grey
*

View File

@@ -55,7 +55,7 @@
<div class="display-space-between">
<label for="transformArea"><b>Insert your XQuery:</b></label>
<div>
<button class="action-button active" id="defaultQueryButton" style="padding: 3px 10px;">Insert default query</button>
<button class="action-button active" id="defaultQueryButton" style="padding: 3px 10px;" onclick="fillDefaultXQuery();">Insert default XQuery</button>
</div>
</div>
<pre><code class="language-xml bordered-field textarea-300" id="transformArea" contenteditable="True"></code></pre>