简体   繁体   中英

send information via form without transaction in another page PHP

as i told, i need a form that send some information to another page but do not go to action page. is it possible? a form is like this:

<form name="form2" method="post" action="send.php"> 
<input type='text' name='name' id='name' value='ali'/>
<input type='text' name='id' id='id' value='123'/>
<input type='text' name='family' id='family' value='ali'/>
</form>

i want when i click on button, just send information. is it possible or needs to use of session?

Use ajax:

var name   = $('#name').val();
var id     = $('#id').val();
var family = $('#family').val();
$.ajax({
    url : 'send.php',
    type : 'post',
    data : {name:'name',id:'id',family:'family'}
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM