You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

You can implement simply code can get processed result by jQuery in javascript/HTML5

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<script>
function getResult()
{
    var fd = new FormData();
    fd.append("name", document.MainFrm.uname.value);
    jQuery.ajax({
        url: "ajax.php",
        type: "post",
        data: fd,
        contentType: false,
        processData: false,
        async: false,
        success: function(response)
        {
            alert(response);
        }
    });
}
</script>

<form method=post name=MainFrm>
    <table>
    <tr>
        <td>Name <input type=text name="uname" value="Chun Kang"></td>
        <td><input type=button value="Get Result" onClick="javascript:getResult();"></td>
    </tr>
    </table>
</form>


ajax.php
<?php

extract( $_POST);

echo "Hey {$name}, howdy?";

?>
  • No labels