Skip to content

Instantly share code, notes, and snippets.

@alexvas123
Created May 25, 2016 12:24
Show Gist options
  • Save alexvas123/8f3dc78471c65abeeb3aae7b45886f66 to your computer and use it in GitHub Desktop.
Save alexvas123/8f3dc78471c65abeeb3aae7b45886f66 to your computer and use it in GitHub Desktop.
AJAX Switch Case
//AJAX BEGINS
$('.buttonsContainer').find('a').on('click', function (e) {
e.preventDefault();
cache: false;
$('.jumbo').fadeOut();
var attrValue = $(this).attr('href');
switch (attrValue) {
case 'agnetha.html':
$('#hidden').load('agnetha.html').fadeIn();
break;
case 'bjorn.html':
$('#hidden').load('bjorn.html').fadeIn();
break;
case 'benny.html':
$('#hidden').load('benny.html').fadeIn();
break;
case 'frida.html':
$('#hidden').load('frida.html').fadeIn();
break;
case 'bennyBjorn.html':
$('#hidden').load('bennyBjorn.html').fadeIn();
break;
case 'stig.html':
$('#hidden').load('stig.html').fadeIn();
break;
case 'band.html':
$('#hidden').load('band.html').fadeIn();
break;
}
});
//AJAX ENDS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment