[jQuery] AJAX Load two external files into separate divs
I am trying to use AJAX to load two external files into separate divs.
I have one file loading into one div with no problem. I am thinking
that if I can just repeat this action with the other url for the other
external file and chain the two together so that a click on ONE link
will load TWO files into seperate divs. But thati's where I'm
lost...any help would be appreciated! Here's the code below(modified
from some found on NetTuts):
$(document).ready(function() {
$('a.details').click(function(){
var toLoad = $(this).attr('href');
$('#foo').fadeOut('fast',loadContent);
$('#load').remove();
$('#foo').append('LOADING...');
$('#load').fadeIn('normal');
function loadContent() {
$('#foo').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#foo').fadeIn('normal',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
return false;
});
});
(p.s. is there a way to make this solution degrade gracefully so that
is someone doesn't have js enabled, it would still work for them?)