Here is a different approach. Include the javascript source for the
weather.ibegin.com in the body of your page. On load run a delayed
function to see if it has written its forecast to your page. I ran
this on a test page and it worked. I could never get the ibegin source
to fail, therefore I had to change the script source to something else
like http://foo.weather.ibegin.com/... to simulate failure. BTW, I was
playing with the widget, so my example gets a different forecast than
yours.

<script>

        var ibeginHTML;
        function ibeginLoaded() {
                ibeginHTML = $("#ibegin div").html();
                if (ibeginHTML == null) {
                        alert('Widget not loaded');
                        // You'd do something useful here like insert your 
missing widget
image
                }
        }

        function ibeginTest() {
                // Give the widget a few seconds to load
                setTimeout('ibeginLoaded();',2000);
        }

        $().ready(function(){
                ibeginTest();
        });

</script>
</head>
<body>
 ... other content ...
<div id="ibegin">
<script type="text/javascript" src="http://foo.weather.ibegin.com/js/
us/nm/santa+fe/1/1/1/1/1/
custom.js&background_color=ffffff&color=000000&width=175&padding=10&border_width=1&border_color=000000&font_size=11&font_family=Tahoma&showicons=1"></
script><noscript><a href="http://weather.ibegin.com/";>Weather
Information by iBegin</a></noscript>
</div>
 ... more content ...
</body>
</html>

On Sep 7, 3:55 pm, bcbounders <[EMAIL PROTECTED]> wrote:
> OK... so here's what I've got so far.  I'm trying to work out the
> jQuery so that if the iBegin weather widget is successfully loaded,
> then the <div id="weather"> is shown... otherwise, it's hidden.
>
> <script type="text/javascript">
>         jQuery.ready(function(){
>                 jQuery("#weather").replaceWith({
>                         jQuery.ajax({
>                                 type: "GET",
>                                 dataType: "script",
>                                 url: 
> "http://weather.ibegin.com/js/us/ak/ninilchik/0/0/1/1/0/
> custom.js&background_color=transparent&color=093384&width=200&padding=0&border_width=0&border_color=transparent&font_size=18&font_family=inherit&showicons=1",
>                                 success: function(){
>                                                 jQuery("#weather").show()
>                                         },
>                                 error: function(){
>                                                 jQuery("#weather").hide()
>                                         }
>                         });
>                 });
>         });
> </script>
>
> But... what I've got isn't working.  And, being new to jQuery (and
> Javascript), I'm not sure why it's not working... or even if this is
> the best route to try and achieve what I want.
>
> Can someone take a look and provide some feedback?  I'd really
> appreciate it!
>
> Thanks a lot!
>
>  - John
>
> On Sep 6, 10:49 am, bcbounders <[EMAIL PROTECTED]> wrote:
>
> > Rene,
>
> > Thanks so much for posting.
>
> > I got the site up, using the iBegin weather widget on it's own.  If it
> > helps, here's a link:  http://tinyurl.com/5n8mco
>
> > I'll take a stab at doing what you suggest... wish me luck! :D  But...
> > expect to hear more questions from me soon.
>
> >  - John

Reply via email to