123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- function showDocument(fr = "") {
- if(fr != ""){
- $.ajax({
- type: "GET",
- url: 'https://centurio.work/out/frames/' + fr + '/dataelements.json',
- success: function(ret) {
-
- $("#alldata").text(JSON.stringify(ret["ausfuehrungen"]));
- },
- error: function() {
- reason = '';
- clearDocument();
- }
- });
- }
- }
- function clearDocument() {
- console.log('rrrr');
- }
- function init() {
- es = new EventSource('handler/sse/');
- es.onopen = function() {
- showDocument("FormTest");
- // load
- };
- es.onmessage = function(e) {
- if (e.data == 'new') {
- reason = '';
- showDocument();
- }
- if (e.data == 'reset') {
- reason = '';
- showDocument();
- }
- else{
- if(e.data != "keepalive" && e.data != "started"){
- try {
- showDocument(e.data);
- }
- catch (e) {
- }
- }
-
- }
- };
- es.onerror = function() {
- reason = 'Server down.';
- clearDocument();
- setTimeout(init, 10000);
- };
- }
- $(document).ready(function() {
- init();
- });
|