You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, July 30th 2018, 12:03pm

Problem with onviewchanged

Hi all. I want to make one ajax request a second after the view has been stopped. In app.js, I have a function:
function getHotSpots() {
console.log('============');
console.log('run');
clearTimeout(timer);
timer = setTimeout(function(){
$.ajax({
url: 'get-hotspots',
data: { atv: krpano.get('view.vlookat'), ath: krpano.get('view.vlookat'), limit: 3 },
success: function(res){
console.log('completed');
}
});
}, 1000);
}


and a set it to onviewchanged event: <events name="hotspots_visibility" keep="true" onviewchanged="js(getHotSpots())"/>
but it's worked incorrectly ( infinite loop ajax ).
- If I replace ajax with anything (eg: console.log('111')) => it's work OK.

- I tried add this function to input: <input type="text" onkeydown="getHotSpots()" />
=> It's work OK.
Anyone help me resole this? Is this a bug of krpano?

This post has been edited 2 times, last edit by "phidangmtv" (Jul 30th 2018, 12:35pm)


2

Monday, July 30th 2018, 12:35pm

It worked with XMLHttpRequest. Please close this topic