Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 40

Thread: web server; sending events and polling lua variables

  1. #11
    Join Date
    Oct 2005
    Posts
    307

    Default

    I initially thought you had failed to add the test variables (listed in the test.html file) to Girder and/or one of the jQuery references were invalid. Both proved to be ok. I downloaded the link and placed it in a subdirectory, did not add the variables and it ran fine for me. What build of Girder are you running? Do you have an alternate browser installed that you could try?

  2. #12
    Join Date
    Aug 2004
    Location
    The Netherlands (Norg, near Assen)
    Posts
    625

    Default

    Strange enough it works on another laptop an my iPad. Do you, or someone else have a working example of an realtime update of Girder variables on a webppage?

    My goal is to get multiple Girder variables (and some table values) to update my webpage every second.

    A have studied many examples but can't get it operational. I'is very difficault for me to debug the Java, Jquery, JSON language.
    Geert

  3. #13
    Join Date
    Oct 2005
    Posts
    307

    Default

    Post what you have so far and I'll try to help. The scripting language is javascript not java (might seem trivial, but will aid if you have to get stuck and need to google).

  4. #14
    Join Date
    Aug 2004
    Location
    The Netherlands (Norg, near Assen)
    Posts
    625

    Default

    I have nothing so far because it does not work. I tried dozens of things. When you can make the the test.html in ' webevents_and_lua_polling.zip' working to periodically update a variable (myVal) and and a table variable (myVal[1]) on the webppage (and really displaying it), it would be nice. The simplest working example is the best as a starting point.
    Geert

  5. #15
    Join Date
    Oct 2005
    Posts
    307

    Default

    Attached is a basic test.html that should refresh myVal every second. This will fail if myVal is a table vs. a variable. If you have a table structure that you need to use, post it and I will take a look.
    Attached Files Attached Files
    Last edited by shaun5; February 9th, 2012 at 06:04 PM.

  6. #16
    Join Date
    Aug 2004
    Location
    The Netherlands (Norg, near Assen)
    Posts
    625

    Default

    Thanks for this file. When I open it is does not do anything exept showning the text 'mytable value in Girder:'. It looks the script does not execute.
    I inserted on different place the command 'alert("test")' but does not give a popupmessage.
    I also tried using a local javascript library but no change. I also do not get an error when loading the webpage.
    Sorry for the delay before my reaction but my reply for some dayss ago seems to be gone.
    Your help is very much appreciated.
    Geert

  7. #17
    Join Date
    Oct 2005
    Posts
    307

    Default

    I had an extra } and a missing ). test.zip updated in previous post...

  8. #18
    Join Date
    Aug 2004
    Location
    The Netherlands (Norg, near Assen)
    Posts
    625

    Default

    After I changed <div id="errors"></div> to <div id="error"></div> I got an error '" INCORRECTLY FORMED JSON DATA...'.
    I entered the alert function in the function down:
    Code:
    function checkDATA(data) {
    alert(data)
    try {
    jsonOBJ = jQuery.parseJSON(data);
    $("#test").text(jsonOBJ[key]);
    }
    catch(err) { $("#error").append(" INCORRECTLY FORMED JSON DATA...");}
    }
    Then I get {"myVal":12345}. This is indeed the value from Girder. So we are getting somewhere.
    What can I do to display it on screen?
    Can you also give me an example when I want to display a table value AD.Value[1]? The array goes from AD.Value[1] till AD.Value[16]. Also with numeric indexes.
    Geert

  9. #19
    Join Date
    Oct 2005
    Posts
    307

    Default

    I'm writing code away from my server (so please excuse my constant stream of errors/typos). Anyway, I've edited the test.html file in the previous post to fix the issues and display the AD.Value array. Since I have added more code, I've probably added more errors...

  10. #20
    Join Date
    Aug 2004
    Location
    The Netherlands (Norg, near Assen)
    Posts
    625

    Default

    Sadly the script does not run anymore (no alert popups). Is it possible to split the two examples to make debugging al little bit easier (or first only the myVal example)? Accidentely I overwrote your previous working example. So I can't use it to find out whats wrong?
    Geert

Page 2 of 4 FirstFirst 1234 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •