/    Sign up×
Community /Pin to ProfileBookmark

Calling parent function after reload

I have a page that contains an iframe and a group of buttons to traverse thru a recordset. When the user adds a new item to the recordset, I have set up some code to have the main page reload to update the number of items in the recordset. The issue I’m having is that after performing the reload, I want to call the goLast function of the main page, but it is not working properly. I’m almost certain that it doesn’t work because it doesn’t have enough time to perform the reload before the goLast function is called. If I insert an alert box between the 2 function calls, the goLast function is called correctly and the screen updates to display the last item that was added.
So my question is… How do I give the browser enough time to reload before I call the goLast function? Any and all help is greatly appreciated.

Chris

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisMay 20.2009 — Use the onLoad function to trigger the goLast function.
Copy linkTweet thisAlerts:
@chrscoteauthorMay 20.2009 — That would be fine if I always wanted the page to load the last item. However, I only want it to do this after someone adds a record to the DB. The first time they open this page, for example, I would want them to be at the first item, not the last.
Copy linkTweet thisAlerts:
@gil_davisMay 20.2009 — Then all you would have to do is let the page know that this isn't the first time.

Instead of reload, you could change the window location and by adding a parameter to the querystring you can tell it this is not the first time.

Or, use a hidden form field to carry a "not first time" flag.

Or, better yet (more general usage) invent a way to specify which record to display first so that it always knows which one to show. The default (no record number specified) could be "first item".
Copy linkTweet thisAlerts:
@gil_davisMay 20.2009 — Or, a cookie...
×

Success!

Help @chrscote spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...