Link to home
Start Free TrialLog in
Avatar of Yannie
Yannie

asked on

Refresh page using ajax

Dear all,

I have a qn on how I can set it to refresh the page. Ajax doesn't do the refresh and awaits it to load. That's what I want.

However, on the main page, I have an iframe containing a page called pms_list.asp.
Upon clicking the item name in the list, another window will show up in this popup window page called maint_main.asp. If i want to submit a new record to the list, I will have to click a button on maint_main.asp and redirect to maint_new.asp.

Now if i submit maint_new.asp with the records inserted, how do I refresh the pms_list.asp which is not the parent page at all?

Anyone can help me with this asap?

Avatar of Zvonko
Zvonko
Flag of North Macedonia image

The script to refresh the parent of the iframe is this:

 onClick="opener.parent.location.reload(true);"

But that will not help because the onClick will do the refresh imideately on link click not after the update was done on server side.
So your response to the link click should contain the refresh() call like this:
<script>opener.parent.location.reload(true);</script>

Send that snippet after update on server side to the popup and the iframe container page will be reloaded.


Actually, it should be this:

<script type="text/javascript">
window.opener.frames['PMS_LIST_IFRAME_NAME_HERE'].location.reload(true);
</script>

Output the above script from the page called from your AJAX that updates the list database.

Regards...

Please remember that pasting responseText into a div using innerHTML will NOT execute any script.
Avatar of Yannie
Yannie

ASKER

Actually

<script>opener.parent.location.reload(true);</script>

refreshes but i will have to wait for th page to refresh done.
I tot Ajax refreshes it alot faster and doesnt show obvious refresh in the background
Avatar of Yannie

ASKER

Actually

<script>opener.parent.location.reload(true);</script>

refreshes but i will have to wait for th page to refresh done.
I tot Ajax refreshes it alot faster and doesnt show obvious refresh in the background
ASKER CERTIFIED SOLUTION
Avatar of ziffgone
ziffgone
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Yannie

ASKER

OK thank you very much. Managed to get it solved in my own...thank you..