Reload div from the parent window with Javascript from a pop-up window

0

I have a page ( parent window ) that opens a pop-up window ( daughter ) with JavaScript , and by clicking a button from the window daughter, it closes, and I need to update a div of the parent window.

I tried with parent.location.reload but I reload the whole page and I do not want that, I want to update only a certain element of the screen.

I've also tried doing document.getElementById.reload but it does not work either. Is there any way to do this with JavaScript ?

The value to be updated is updated in Java by a action that the button has. All I need is for that part of the page to be updated to show that value.

    
asked by Blazerg 12.03.2017 в 13:47
source

1 answer

1

HTML elements do not have a location attribute or less support than you reload using location.reload so you should now be receiving the error

Cannot read property 'reload' of undefined

What you could try is to trigger the event by clicking on the button in the parent window:

window.opener.document.getElementById('boton').click()

This assuming that the click on the button just causes the div that contains it to be refreshed.

Otherwise, first you have to give the main page some way to partially reload your content (via ajax for example) to be able to trigger that same action from a daughter window.

    
answered by 13.03.2017 в 12:59