How to refesh a grid in a layout/tab from another window

Yes there were 4 other similar tabs. Removed this code to try and make it clearer. They all need to work the same way.

I tried passing gridNotes through the AddNote method. Not sure why I need to do this as gridNotes is defined outside of the function anyway as shown.

var gridNotes;
function doAddNote(gridPassed){  

function doInitToolbars(){

  // toolbarNotes is the toolbar for the grid and contains a button to add a new record.
  toolbarNotes.attachEvent(“onClick”, function(id){
      if (id == “button_notes_add”)

editSuccess.php (The URL that is attached to the created window)

// dhxToolbar is the toolbar in the pop up window and contyains a button to save the record.
dhxToolbar = window_self.attachToolbar();
dhxToolbar._related_grid = gridPassed;
alert(gridPassed); // Shows that gridPassed is undefined.

How do I get the grid variable from the AddNote function and make it available in the window containing the attached URL?

attachURL loads content into an iframe. The iframe is available by _frame property:

var frame = win._frame;

So, grid object is

var grid= frame.contentWindow.gridObject;

In case of calling parent methods from apage inside an iframe: parent.someFunction();