On success of ajax request, i load a script using,
$.getScript(base_url + 'js/js_to_be_loaded.js');
Is there any way i could check if that particular script is already loaded ?
Thanks.
You need only to implement a success
callback function.
jQuery.getScript( url [, success(script, textStatus, jqXHR)] )
like:
$.getScript(base_url + 'js/js_to_be_loaded.js', onSuccess);
function onSuccess(...)
{
// in this function you are guaranteed that it is loaded
// so you can execute code based on the loaded js file or
// set flags to let your code "know" that it is loaded
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.