pashin76,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(function ()
{
function validate(event) {
var $element = $(this),
value1 = $element.data("value1"),
value2 = $element.data("value2");
alert([value1,value2])
}
$("[id^='a']").click(validate);
})
</script>
</head>
<body>
<span id="a11" data-value1="1" data-value2="1">текст</span>
<span id="a50" data-value1="5" data-value2="0">текст</span>
</body>
</html>