jquery - Retrieving Data from a Submitted Form -
i trying submit information through form in separated html file html file wanted retrieve information.
how can value submitted data in file2.html
using jquery , display them?
javascript
$(document).ready(function(){ $("#form").submit(function(e){ e.preventdefault(); var dataform = $(this).serialize(); $.ajax ({ type : "post", url : $(this).attr('action'), data : dataform, success: function(data) { alert(data); } }); });//endsubmit });//end ready
html
<body> <form id="form" action="file2.html"> <input type="text" name="fname" id="fname" value="" /> <input type="text" name="lname" id="lname" value="" /> <input type="submit" id="submit" value="generate signature"> </form> </body>
let me clear 1 thing can send data html file html file need use server side php or .net php try
var data = new formdata($('#form')[0]);//this select form data in data variable. $.ajax({ type:"post", url:"insert.php", data:data, contenttype: false, cache: false, processdata: false, success:function(dta) { alert(dta); } });
you can try tutorial complete explanation http://w3code.in/2015/10/insert-data-in-database-without-refreshing-page-using-ajax-and-php-beginner-guide/
Comments
Post a Comment