Facility Control

 View Only
  • 1.  ogscript.asyncPost

    Posted 02-07-2021 22:12

    Hi all,
    Just a quick question on this topic.
    What is the best way to see what the actual result is from the command:
    ogscript.asyncPost("http://localhost:5201", JSON.stringify(command), null)

    I'm trying to create a command "string" that has a lot of arguments that need to be sent by this command

    Thanks for any help,
    Jerry



  • 2.  RE: ogscript.asyncPost

    Posted 02-08-2021 15:58

    Hi Jerry

    Are you looking to see what the webserver returned or what the stringified version of your command looks like? In either case, the typical thing would be to write the response to ogscript.debug which will write to the openGear Debug Information View (Select from "Views" in the main application menu).

    For the first one:

    var strCommand = JSON.stringify(command);
    ogscript.debug('STRING: ' + strCommand);
    ogscript.asyncPost("http://localhost:5201", strCommand, null)

     

    For the second one:

    var strCommand = JSON.stringify(command);
    ogscript.debug('STRING: ' + strCommand);
    ogscript.asyncPost("http://localhost:5201", strCommand, function (result)
    {
    ogscript.debug('RESULT: ' + result);
    });

     

    Cheers

    James


    #DashBoard


  • 3.  RE: ogscript.asyncPost

    Posted 02-08-2021 17:58

    James
    The second case is the one I'm looking for (to make sure the command(s) is formatted correctly. I'm not a programmer but I am making headway - Thanks again.

    -Jerry


    #DashBoard


  • 4.  RE: ogscript.asyncPost

    Posted 02-09-2021 16:14

    One more simple question... I've found a variety of related topics but all address my issue in more complex ways and as I've said, I'm not a programmer.


    Simply, can I have a string variable in place of the TAKE in this constraint statement

    <constraint key="0">TAKE</constraint>

    The underlying concept is to have a person's name populate the toggle button

    -Jerry


    #DashBoard