Forum Moderators: coopster

Message Too Old, No Replies

update parent window after child window post data back

         

drboring

2:15 am on Dec 22, 2009 (gmt 0)

10+ Year Member



Hi,

I have a web app using php to open PayPal in a child window.

PayPal will return data back to my backend php by "POST".

When the backend php get the data, I would like to update the parent window to display thank you message.

However, I don't have any idea on how to update the parent window.

All help would be apperciated.

Thanks.

nanat

8:37 am on Dec 22, 2009 (gmt 0)

10+ Year Member



echo '<script type="text/javascript">alert("thank you!");
history.go(-1);
</script>';

ALKateb

1:07 pm on Dec 22, 2009 (gmt 0)

10+ Year Member



<script language="javascript" type="text/javascript">
function thankyou(){
window.opener.location = "http://SOMESITE.COM/destinationpage";
}
</script>

that if you want to redirect the parent window to new location
but if you just want it to refresh do this
window.opener.location.reload()

i think this topic should be moved to the javascript forum

if you want the page to display a thank you msg you can create a function on the parent page which displays thankyou msg then refreshes the page so you can call this function from the popup window using window.opener

rocknbil

9:56 pm on Dec 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



However, I don't have any idea on how to update the parent window.

Any document attributes are accessible by window.opener.document. So if you have a form named my-form, a text box comments,

window.opener.document.my-form.comments.value="boo.";

window.opener.document.my-form.submit();

etc . . .

drboring

1:37 am on Dec 23, 2009 (gmt 0)

10+ Year Member



Hi,

Thanks for all the help.

But I can't create any javascript in "PayPal" (child window).

Please advise.

Thanks.

TheMadScientist

5:05 am on Dec 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why not just use PayPal's Auto Return instead of reinventing the wheel?

You can get the information instantly with PDT turned on and then you can use PayPal's IPN to update your db information any time the status changes and send a message to the visitor or whatever you would like to do.

Personally, I wouldn't make it any tougher than it is...
Turn Auto Return On.
Turn PDT On.
Set Your Thank You Page to Accept & Display PDT Variables.
Be Done With It.

If you're concerned about some visitors not being returned to your thank you page because you do not require an account (it's generally the only way they're not returned automatically) and they have to click 'continue' to get back, then open the payment page in a new window and don't worry about it if they don't see your thank you message... they still get a receipt and obviously didn't want to see your thank you that much or they would have clicked continue instead of moving on to another site.

drboring

1:30 am on Jan 4, 2010 (gmt 0)

10+ Year Member



Hi,

My problem solved.

Thanks.