If the script does not exist then the insertion of the <script>
element will fail (which is how cross domain getScript() works). So
you can't really test for a "time out".
However you could set a flag in the success/callback function. After
the getScript() call you could use a setTimeout to test for that flag
after a certain time. If the flag isn't set then the load didn't work
or took too long.
Karl Rudd
On Thu, Mar 26, 2009 at 1:49 AM, Maujor <
css.maujor@...> wrote:
>
>
> I have the following AJAX request.
>
> $(document).ready(function() {
> var iconLoading = $(' mini.gif ');
> var pluginLoaded = $('Plugin ready');
>
> var requestScript = function() {
> $(iconLoading).insertAfter('#my_button');
> $.getScript('
http://www.domain.com/jquery.corner.js', function() {
> $(iconLoadind).hide();
> $(pluginLoaded).insertAfter('#my_button')
> .css({background: '#ffc', padding:'3px 5px'})
> .fadeOut(3000);
> // do something using the just loaded plugin
> });
> });
> };
> $('#my_button').bind('click', requestScript);
> })
>
> Suppose the requested script is unavailable.
> How do I set a time interval in order to abort the request?
>
>
> -----
> Maurício Samy Silva
> --
> View this message in context:
http://www.nabble.com/aborting-a-%24.getScript%28%29-request-tp22703190s27240p22703190.html> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>