php - send form data to two pages via ajax -
im having little problem here, have form, 2 fields, need form redirect me specifil location, example 1.php, , need values form sent 2.php @ once, php couldnt it, im guessing ajax can done, ideas?
<form action="1.php"> <input type="text" name="value1"> <input type="text" name="value2"> </form>
why im doing this? search form, have jquery pagination on form action, pagination gets data 2.php, need data sent also, need in 1.php , 2.php
ideas?
you can same sending data asynchronously other page html5 formdata. here's code :
<form action="1.php" onsubmit="senddata()" id="myform"> <input type="text" name="value1"> <input type="text" name="value2"> </form> <script> function senddata() { var formdata = new formdata(document.getelementbyid('myform')); $.ajax({ url: '2.php', //server script process data type: 'post', //post or xhr: function() { // custom xmlhttprequest var myxhr = $.ajaxsettings.xhr(); return myxhr; }, data: formdata, //form data //options tell jquery not process data or worry content-type. cache: false, contenttype: false, processdata: false }); }
Comments
Post a Comment