• Clever Geek Handbook

    Javascript / JQuery: refresh tab in parent

    I have a (parent) window containing JQuery tabs:

     <div id="tabs"> 
          <ul class="tabHeader"> 
               <li><a href="?ctrl=doSomething" title="#tabs-something">
                      Awesome function</a></li> 
               <li><a href="?ctrl=showSettings" title="#tabs-showSettings">
                      Settings</a></li> 
          </ul>
     </div>
    
          

    Inside # tabs-showSettings, I require in some cases a new window that I open using the following code:

    window.open('?control=showSetting&server='+server,
        'serverSettings','width=400');
    
          

    This works great. But in this window, I need a function to send the inputted data (works correctly), update the div inside the parent (doesn't work) and close the child window (works). This is what I tried:

    // #1: the following would refresh the div within the child ;(
    parent.$('div#tabs-showSettings').load('?control=showSettings');
    // #2: the following doesn't seem to have any effect
    window.opener.$('div#tabs-showSettings').load('?control=showSettings');
    
          

    Please tell me what I am doing wrong. Thank you so much!

    Decision:

    $("div#tabs-showSettings", window.opener.document).load(
        "?control=showSettings", function(){
        window.close();
    });
    
          

    +2
    javascript jquery user-interface


    MrG 25 Aug 09 at 20:18
    source to share


    1 answer


    Try the parent context:

    $("div#tables-showSettings", window.opener.document)
      .load("?control=showSettings");
    
          

    Update:



    Some comments indicate to close the window after the updates are complete - this should be handled in a callback:

    $("div#tables-showSettings", window.opener.document)
      .load("?control=showSettings", function() { window.close(); });
    
          

    +1


    Sampson 25 Aug 09 at 20:23
    source to share






    More articles:

    • fpdf Таблицы: Разделение/слияние ячеек - split
    • Can this JavaScript be optimized? - performance
    • PropertyGrid: Receive PropertyValueChanged Notifications from CollectionEditor - c #
    • Java ActionListener for an unnamed JButton? - java
    • Простой тест jQuery с использованием функции "переключить", не ведет себя так, как ожидалось - jquery
    • DPI Explained Image - dpi
    • "LISP package error -UNIT not loaded" in Cusp Eclipse plug-in - eclipse
    • C ++ Opening a file and entering data into a class object - c ++
    • Есть ли способ просмотреть историю по всей папке в Borland StarTeam? - version-control
    • What's the most efficient way to inject new code into the DOM? - performance

    All Articles

    Daily Blog | 2020

    Green Geek Media (GGM)
    1298 Despard Street
    GA 30344 East Point, USA
    404-763-3837