Return to Snippet

Revision: 58950
at August 10, 2012 18:48 by rickygri


Initial Code
// On click "button.submit"
$("button#submit").click(function () {
    // Send to submit.php
    $.post("controller/submit.php", {
        // Send these values via POST
        val1: $("#val1").val(),
        val2: $("#val2").val()
    }, function(result){
        // Return result
        $('#output').html(result);
    });
});

Initial URL


Initial Description
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

Initial Title
POST form with jQuery (Ajax)

Initial Tags
form, ajax, javascript, post, jquery

Initial Language
JavaScript