function validate(event) {
var $element = $(this),
value1 = $element.data("value1"),
value2 = $element.data("value2");
…
}
$("#a11").click(validate);
.......
$("#a50").click(validate);
<span id="a11" data-value1="1" data-value2="1">текст</span>
<span id="a50" data-value1="5" data-value2="0">текст</span>