jQuery onsubmit不起作用

I have a form

    <form id="formModLezione" method="post">

now, I'm trying to do this:

 var messaggio="";
 var url = "EsistonoIscritti";
 var xmlHttp = new XMLHttpRequest();
 xmlHttp.open("POST", url, false);
 xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
 xmlHttp.send("id="+id);
 xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4) // COMPLETED
{   if (xmlHttp.status == 200) // SUCCESSFUL
        {var str = xmlHttp.responseText;
         if (str.localeCompare("ko") != 0) {//ci sono utenti iscritti
             var utenti=JSON.parse(str);
             messaggio+="A questa lezione sono iscritte le seguenti persone, avvertile!
";
      for(var i=0;i<utenti.length;i++){
        messaggio+=(i+1)+") "+utenti[i].nome+" "+utenti[i].cognome+" Tel."+utenti[i].telefono+"
";
      }
        messaggio+="Vuoi procedere?";
        alert("messaggio");
         }
    } else {
        alert("An error occurred while communicating with the server.");
            }
    }
};
$("#formModLezione").on("submit","return confirm('"+messaggio+"');");
$("#formModLezione").attr("action","ModificaLezione?id="+id);

When I click on the submit button of the form the call to the servlet ModificaUtente works but doesn't show me any alert! Someone know why? thanks!

Not sure that there is a syntax problem, but something like this maybe?

$("#formModLezione").on("submit", function(){
    confirm(messagio);
});

try

$("#formModLezione").bind("submit", function(e){
   e.preventDefault();

    confirm(messagio);
});