How can I name and call a jQuery function?
function doSomething() {
$.ajax(...);
}
$('#EID').change(doSomething);
Note that you must not add ()
after the function name since you want to pass the function, not its return value.
In case you wanted to pass some parameter to the function, you'd do it like this:
function doSomething(someParam) {
$.ajax(...);
}
$('#EID').change(function() {
doSomething(whateverSomeParamShouldBe);
});