Form Submit and Ajax call

Form Submit and Ajax call


Hi all,
      Please let me know whether this works..(ajax call inside form submit)
Thanks in Advance..


<html>
<head>
<script>
$(document).ready(function()
{

$("#form1").submit(function(){

$.ajax({
 url:"servlet2",
 data:({name:"kiran"}),
 type:"POST",
 dataType:'xml',
 success:
        //any code here
});


});

});
</script> 
</head>
<body>

<form action="servlet1" name="form1" id="form1">
<input type="text">data</input>
<input type="submit">submit</input>

</form1>

</body>

</html>