homepage Welcome to WebmasterWorld Guest from 184.73.104.82
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Using body onLoad event
..but with reference to external .js script
rpking

10+ Year Member



 
Msg#: 950 posted 2:50 pm on Dec 3, 2003 (gmt 0)

I have a simple page which creates a form and then immediately posts itself to another page, passing the formatted data across.

This page currently works very well, and I can't really its functionality.

I now need to pass some of the data to a third party site, and I'm aiming to do this by passing the data as parameters in a url. I will make the call to the url by calling an external JavaScript file.

This works fine, and passes the data across without a problem. However, I'm worried that if the third party site goes down, my page will not redirect as the onLoad event will take ages to trigger.

Passing the data is secondary to preventing my site from breaking.

I also considered calling a gif, but then the onLoad will still be waiting... any ideas?

 

HocusPocus

10+ Year Member



 
Msg#: 950 posted 3:16 pm on Dec 3, 2003 (gmt 0)

Would this work?

<SCRIPT>
function passParams{
var testImage= new Image();
testImage.onload = function(){//pass the params}
testImage.onerror = function(){//dont pass params }
testImage.src = 'http://testServerAlive.com/theImage.gif';
}
</SCRIPT>

<BODY onload=passParams() ..

rpking

10+ Year Member



 
Msg#: 950 posted 3:18 pm on Dec 3, 2003 (gmt 0)

Hmmm... I like it... I'll give it a go.

rpking

10+ Year Member



 
Msg#: 950 posted 3:38 pm on Dec 3, 2003 (gmt 0)

Looks to be working. Nice one, thanks a lot.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved