Send data from joystick script

HI. I'm using in UI template node and code form github:

How can I send data form x and y value to payload

Here is a code:

        <script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
        <script type="text/javascript" src="js/underscore-min.js"></script>
        <script type="text/javascript" src="js/backbone-min.js"></script>
        <script type="text/javascript" src="js/joystick_view.js"></script>

    <script type="text/html" id="joystick-view">
    <canvas id="joystickCanvas" width="<%= squareSize %>" height="<%= squareSize %>" style="width: <%= squareSize %>px; height: <%= squareSize %>px;">

    <div id="joystickContent">
        x: <span id="xVal"></span><br/>
        y: <span id="yVal"></span><br/>

    <script type="text/javascript">
            var joystickView = new JoystickView(150, function(callbackView){
                }, 0);
            joystickView.bind("verticalMove", function(y){
            joystickView.bind("horizontalMove", function(x){

Here's something similar you could probably 'adjust/hack' to meet your needs.
Some jQuery and Ajax to send values of 'soft buttons' to Node-RED to control something.

1 Like

Do you mean you want to know how to send a message to node-red from a ui template node? If so then this may help.

Thanks. But how can i add this to my example ?