• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 668
  • Last Modified:

AJAX refresh pause question

I have developed a SCADA app that uses AJAX to ping my DB on a regular interval, which serves as a silent refresh on the page.  It works beautifully, with the one exception of when a user attempts to open a drop down menu.  Because the menus are located on the child page, the silent refresh kicks the user out of the menu when triggered.  Is there a way to freeze the refresh contingent upon the menu form being opened?  This is tricky because the refresh command is located on the parent page.  

Your help is most sincerely appreciated.
0
Titus57
Asked:
Titus57
  • 2
  • 2
1 Solution
 
grahamnonweilerCommented:
The child page (if an iFrame) can access the parent document provided they are in the same "domain".

You can have a pause function in the parent document and then call it from the child when the focus in the child page passes to the drop down.

Example:

In the parent page:

function pauseMe() {
alert('I have been paused!');
}

In the child page:

<select name="dropdown" onFocus="parent.pauseMe()"><option></option</select>
0
 
Titus57Author Commented:
Okay, that makes sense... my particular solution is classic asp, so I'm not sure if the syntax would be the same.  Both parent and child frames have .asp extensions.  Do you have a suggestion for how I can make a callback to the parent with that layout?

I am not opposed to using an iFrame if it gets the job done, I just am not familiar enough with them to know if they can handle processing dynamic db content like asp can.
0
 
grahamnonweilerCommented:
If the ASP pages are being rendered in HTML the syntax in terms of calling the parent frame would essentially be the same.

In other words:  parent.functionname()

Iframes would provide the same level of reliability and speed, but if you are not familiar with them better to avoid them as this could just end up creating a different set of problems for you!

It is a long time since I touched anything related to SCADA - but it used to rely heavily on HTML rendering hence my original suggestion.
0
 
Titus57Author Commented:
I actually didn't wind up using this solution but it is viable.  I ended up blowing up the entire process and reworking the AJAX to conditionally refresh only when prompted and stop after a fresh timestamp was seen in the db, thus eliminating the need for the pause... a much less data/processor intensive solution with nearly identical results
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now