locked
How to continuously passing data from service to view RRS feed

  • Question

  • User-467044538 posted

    Hi, I have an objective to keep pass Kafka Message from background service to front-end javascript to display the results.

    Any tips or source to start with this use case? 

    Thanks in advance.

    Thursday, June 13, 2019 2:58 AM

All replies

  • User-2054057000 posted

    You will have to use .ajax() method to do this kind of work. You will also need to run your JavaScript code every 5 seconds time so that you can do the checking purpose. For this you will need to use .setInterval() method of JavaScript.

    The code skeleton will look like:

    setInterval(checkService, 5000);
     
    function checkService() {
        //here make AJAX call
        $.ajax({
          type: "POST",
          url: "",
          data: {},
          success: function (msg) {
            
          },
          error: function (req, status, error) {
                  }
        });
    }

    Thursday, June 13, 2019 4:48 AM