Posted By

rickygri on 08/10/12


Tagged

form ajax javascript post jquery


Versions (?)

POST form with jQuery (Ajax)


 / Published in: JavaScript
 

This send any value via POST to a PHP page. It is done with AJAX, so the POST return can be used on the same page as the submit

  1. // On click "button.submit"
  2. $("button#submit").click(function () {
  3. // Send to submit.php
  4. $.post("controller/submit.php", {
  5. // Send these values via POST
  6. val1: $("#val1").val(),
  7. val2: $("#val2").val()
  8. }, function(result){
  9. // Return result
  10. $('#output').html(result);
  11. });
  12. });

Report this snippet  

You need to login to post a comment.