Sie sind nicht angemeldet.

panomedia

Anfänger

  • »panomedia« ist der Autor dieses Themas

Beiträge: 15

Wohnort: Athens, Greece

Beruf: Photographer

  • Nachricht senden

1

Donnerstag, 26. Juni 2014, 13:59

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 */
});
}

2

Freitag, 27. Juni 2014, 08:03

Hi,

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

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

Here some dummy example code - in the xml do:

Quellcode

1
js( getData(...) );


in html/js do:

Quellcode

1
2
3
4
5
6
7
function getData(...)
{
   ... do something ...
   var krpano = document.getElementbyId("krpanoSWFObject");
   krpano.set("hotspot[...].anydata", ...);
   krpano.call("custom_done_action()");
}


Best regards,
Klaus