Skip to content

Instantly share code, notes, and snippets.

@kevinwritescode
Created October 11, 2012 23:56
Show Gist options
  • Select an option

  • Save kevinwritescode/3876482 to your computer and use it in GitHub Desktop.

Select an option

Save kevinwritescode/3876482 to your computer and use it in GitHub Desktop.
$('.ajaxloader').change(function(e) {
e.preventDefault();
console.log('top leveler');
var value = $(this).val();
var child = $(this).attr('data-child');
var ajaxurl = $(this).attr('data-ajax');
if (child && ajaxurl) {
var el = $('#' + child);
el.parent().parent().hide();
if (value) {
el.load(ajaxurl + value + ' option', {}, function() {
if ($(this).children().length > 1) {
$(this).trigger("liszt:updated");
$(this).parent().parent().show();
}
});
}
}
}).change();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment