Connection and Data Retrieving from Server for HotSpots ????

  • Let's say that we have created a presentation with krpano in order to present some items (hotspots).

    You click on a item and you get one or more photos, a description about the item and a couple of links for the item itself.

    Is it possible to get all the data from a server(photo, description etc)?
    Is there any way to perform any AJAX like requests in order to keep the krpano XML small and at the same time get the latest data from a server?


    Lets say that function getData connects to our server and retrieves data.

    dummy example
    text_1= getData('text', 'item 1');
    image_1= getData('image', 'item 1');

    so inside krpano would exists something like :

    action getData (type, item){
    1) connect to server
    2) return url of photo or the text or some linkes
    }

    For instance in jquery we would write something like :

    function getData (type, foritem){
    $.post( "server/getmesomedataplease.php", { type:type, foritem: foritem})
    .done(function( data ) {
    return data; /*Yes! we got our data , now put them inside the html */
    });
    }

  • Hi,

    you can call from krpano xml to Javascript by using the js() action:
    https://krpano.com/docu/actions/#js

    and then back from Javascript to krpano by using the set/get/call interfaces:
    https://krpano.com/docu/js/#top

    Here some dummy example code - in the xml do:

    Code
    js( getData(...) );

    in html/js do:

    Code
    function getData(...)
    {
       ... do something ...
       var krpano = document.getElementbyId("krpanoSWFObject");
       krpano.set("hotspot[...].anydata", ...);
       krpano.call("custom_done_action()");
    }

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!