开发者

trouble with sending data from html-form

开发者 https://www.devze.com 2022-12-21 07:26 出处:网络
User has html-form, then user fills all field and data transferred to PHP script. How do wo开发者_Go百科uld data send, but not refresh html page?If you don\'t want the page to be refreshed and submit

User has html-form, then user fills all field and data transferred to PHP script. How do wo开发者_Go百科uld data send, but not refresh html page?


If you don't want the page to be refreshed and submit data, you will have to use the ajax for that, have a look at its tutorial at w3school.com


Sounds like an AJAX solution. Quick google search


If you want to send the data without refreshing the page, you'll want to do an ajax submit. The easiest way to do this is via the jQuery AJAX Library. A quick example could be:

//example from the jQuery API docs.
$.ajax({
   type: "POST",
   url: "some.php",
   data: $("#form_to_submit").serialize(),
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
 });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号