Skip to content

Instantly share code, notes, and snippets.

@SpencerCooley
Created May 20, 2013 18:35
Show Gist options
  • Save SpencerCooley/5614260 to your computer and use it in GitHub Desktop.
Save SpencerCooley/5614260 to your computer and use it in GitHub Desktop.
function ajaxStuff1(value){
//do some ajax stuff with a value with a value parameter
}
function ajaxStuff2(value){
//do some other ajax stuff with a value parameter
}
var doStuffWhenSelectIsChanged = function(theId, ajaxStuff){
$(theId).change(function(){
var theValue = $(theId).val();
//do some ajax stuff with access to 'theValue' variable here.
ajaxStuff(theValue)
});
}
doStuffWhenSelectIsChanged('#lang1', ajaxStuff1)
doStuffWhenSelectIsChanged('#lang2', ajaxStuff2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment