Problem with jquery function.

Problem with jquery function.

Hallo everybody.

I have a problem with  a jquery spinner function.
It works good just the first time when I click to increment or decrement the value of the school year. I mean  the school year changes so changes the previous student school year, where there are some data like previous couse, class and so on.

I post the function. If someone would like to help me I'll appreciate very much:

<script type="text/javascript">
function provenienza(arg1, arg2) { 
var request;
request = new XMLHttpRequest();
request.open("GET", "provenienzaDati.php?&a="+codAlunno+"&b="+3+"&c="+arg1, true);
request.onreadystatechange = function() {
if(request.readyState == 4) {
    var response = request.responseText;
    document.getElementById('provenienza').innerHTML = response;
   
    $(function () {
      var splitter = '/';
      $('#annoScol').spinner({
        spin: function (e, ui) {
          e.preventDefault();
          var values = $(this).val().split(splitter),
          annoScol = (parseInt(values[0],10)+ui.value)+splitter+(parseInt(values[1],10)+ui.value);
          $('#annoScol').val(annoScol);
       
        $("div#provenienza").load(
        "provenienzaDati.php",
           { a: codAlunno, b: 3, c: annoScol },
        function(){
          var splitter = '/';
         $('#annoScol').spinner({
         spin: function (e, ui) {
          e.preventDefault();
          var values = $(this).val().split(splitter),
          annoScol = (parseInt(values[0],10)+ui.value)+splitter+(parseInt(values[1],10)+ui.value);
          $('#annoScol').val(annoScol);         
         }
        });
        }); 
        }       
      });
    });         
}
}
request.send(null);
}
</script>

Thanks in advance.

Tegatti.