I am using the following code to preload an mp3:
$.ajax({
url: "boom.mp3",
success: function() {
//done
}
});
Is there anyway I can have multiple elements preloaded (images and mp3 for example)?
e.g.
$.ajax({
url: "boom.mp3", "moo.jpg",
success: function() {
//done
}
});
Cheers!
If you are using jQuery 1.5, there are two new ways to handle this: deferred and promises.
Creating Responsive Applications Using jQuery Deferred and Promises
To use this in your instance, for example, just replace the
ajaxrequests withload.