Now a day jQuery is powerfull library to build different types of applications.
HTML Form can be submitted by different ways.jQuery it can easily submit a form values to server without refreshing the page and without forming the form data we can easily submit the html form using jquery.
See the below code here i am using jquery serialize mothod to form the post or get data and then passing to the ajax page. This is very method when we are using ajax in our application.
jQuery serialization is the best method to get the full form data.
<scipt type="text/javascript">
//this function run when click on button
function form_serialize_ajax_submit(){
//serialize the form data and assign to variable -
var datas = $("#tt").serialize();
//push them to server - using get
//type - get or post
//data - variable that assigned the serialized data
//url - path for handling this request(where the form should submit to- form action url)
$.ajax({
type:'get',
url: 'http://yourservername.com/ajax.php',
data: datas,
dataType: 'html',
success: function(response){
//d variable get the server response for the request, show that in alert
alert(response);
}
});
}
</scipt>
HTML Form Here
<form id="tests" name="seria"> <input name="tt" id="tt" type="text"> <input value="serialize" type="button"> </form>
