3 Replies Latest reply on Dec 19, 2017 11:55 PM by stevegr RSS
    hkim-5 Newbie

    How can I use json file in Thingworx Composer..?

    Hello, I'm Sol

     

    I have some questions. I wanna use Json file in Thingworx but I don't know how to use in Thingworx Composer.

    //-------start-----------

    $subscriptionKey = '440dd540-8db1-3f5d-806e-9b15d5b4bece';


    getWeather();


    function getWeather() {

    $subscriptionKey = '440dd540-8db1-3f5d-806e-9b15d5b4bece';

       

    $(function() {

         var params = {

                version: 1,

                city : "서울",

                county : "강남구",

                village : "도곡동"

    };

            //http://apis.skplanetx.com/weather/forecast/3hours?

    $.ajax({

    url: "http://apis.skplanetx.com/weather/current/minutely?" + $.param(params),

    beforeSend: function(xhrObj){

    // Request headers

    xhrObj.setRequestHeader("appKey",'440dd540-8db1-3f5d-806e-9b15d5b4bece');

    },

    type: "GET",

    // Request body

    data: "{body}",

    })

    .done(function(data) {

    document.write("successss");

             

                document.write(JSON.stringify(data));

                //console.table(data);

               

    })

    .fail(function() {

    alert("error");

    });

    });

    }

    //----------end--------------

    that is my jason file code and I wanna print this code in thingworx.

     

     

     

    /*----------start----------------*/

    <!DOCTYPE html>

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <title>weather info</title>

    <style>

     

    </style>

    </head>

    <body>

          

        <script src="https://code.jquery.com/jquery-1.12.4.js"></script>

        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

    <script type="text/javascript" src="test.js"></script>

     

    <div class="result">

    <p id="resultInfo">ggg </p>

        </div>


        <script type="test/javascript">

           

       

        </script>

       


    </body>

    </html>


    /*----------end----------------*/


    That information is forecast information from south Korea.


    Can I connect this kind of code with Thingworx? I just need to print weather values in Thing worx.