DoyleChris98 Posted March 8, 2015 Share Posted March 8, 2015 I have created a Websocket between my webpage and a application acting like a server on my computer. And the program is sending data though the Websocket, but i am trying to display it. When i open the page in the Chrome Developers Tools i get this. {"message":"SIMCONNECT_RECV_ID_SIMOBJECT_DATA","value":{"COM1_A":128.250000,"COM1_S":128.300003,"COM2_A":127.800003,"COM2_S":127.900002,"NAV1_A":108.500000,"NAV1_S":117.199997,"NAV2_A":110.599998,"NAV2_S":116.800003,"ADF1_A":284.000000,"ADF2_A":240.000000,"XPDR_A":4608}} Now im trying to figure out how to display the data into a div on my webpage. The old way i was displaying it was this way. Javascript jqXHR = $.getJSON("http://" + location.hostname + "/add_definition?definition_name=RADIO&name=COM1_A&PropertyName=COM ACTIVE FREQUENCY:1&UnitName=MHz&DatumType=FLOAT32", function(dane) {});jqXHR = $.getJSON("http://" + location.hostname + "/get?definition_name=RADIO", function(data){definition_data = data;});if (definition_data == undefined)return;var C1A = document.getElementById("COM1A");C1A.innerHTML = definition_data.COM1_A.toFixed(3); HTML <div class="DISP1" id="COM1A" type="button" name="COM1A" onclick="SETFREQ('com1_swap',1)">XXX.XXX</div> Im not sure how to display the data from the message into my page to display. Link to comment Share on other sites More sharing options...
justsomeguy Posted March 9, 2015 Share Posted March 9, 2015 Each of your ajax requests has a callback function. You need to put the code that you want to use the response inside that callback function. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now