jQuery: The Write Less, Do More JavaScript Library

 « Return to Thread: aborting a $.getScript() request

aborting a $.getScript() request

by Maujor :: Rate this Message:

| View in Thread

I have the following AJAX request.

$(document).ready(function() {
        var iconLoading = $('');
        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

 « Return to Thread: aborting a $.getScript() request