AJAX refresh pause question

Posted on 2012-08-20
Last Modified: 2012-08-24
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.
Question by:Titus57
    LVL 16

    Accepted Solution

    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.


    In the parent page:

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

    In the child page:

    <select name="dropdown" onFocus="parent.pauseMe()"><option></option</select>

    Author Comment

    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.
    LVL 16

    Expert Comment

    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.

    Author Closing Comment

    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

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Cannot submit form in ASP.NET MVC 3 48
    json example 39 78
    Import csv files to MS SQL 5 35
    Get value before .onChange() 5 0
    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now