Question: I have a Form 

```
<script type="text/javascript" src="result.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<form name="form" method="POST" id="form">
    <input type="text" value="" id="htno" name="htno" Maxlength="12" style="width:165px;" class="bodytext"></input>
    <input type="button" value="Submit">
</form>
<div id="result" class="result"></div>

```

And result.js file is 

```
$("#form").submit(function (event) {
    event.preventDefault();
    $("#result").html('');
    var values = $(this).serialize();
    $.ajax({
        url: "url",
        type: "post",
        data: "htno=" + htno + "&code=2132",
        success: function () {
            alert("success");
            $("#result").html('submitted successfully');
        },
        error: function () {
            alert("failure");
            $("#result").html('there is error while submit');
        }
    });
});

```

htno is the value the user enters through form

Data to be posted is htno & code

i am unable to get output using this, please can u tell me the fault . . . .

Answer: 
You should know that a form is submitted when the input type is submit.In your code change the type of button to submit. 

just change the part 

```
<input type="button"  value="Submit" >

```

to

```
 <input type="submit"  value="Submit" >

```

and in your result.js remove this line

```
event.preventDefault();

```

because this line prevent your form from submitting without any reason.
try changing your

```
 $("#form").submit(function(event) {
 event.preventDefault();

```

by

```
$(document).on('submit','#form',function(e) {
e.preventDefault();

```

alto, try to alert data