dimanche 28 juin 2015

How to write php code inside jquery to update database table

I am working in Banking project .I want to write php code to update table upon successful Transaction using ajax . suppose i am sending request from fundtransfer.php to external API and the External API is also responding correctly .Now upon successful API respond i want to update my database table field name status from pending to completed .

    <script>
        $(document).ready(function()
        {
            $.ajax(
            {
            url:"http://ift.tt/1HoFteZ",
            type:"post",
            data:"variable="+value,
            success:function(result)
            {
                if(result==100)
                {
                    $("#message").html(successful transaction);
                    //Now i want to update my database tabale status saying Successful Transation 
                    //where to write these all php mysql code to update my database table
                   // without loading and redirecting page
                }   

                else
                {
                    $("#message").html(some thing gone wrong);
                }

            }
            });
        });
    </script>

Aucun commentaire:

Enregistrer un commentaire