Insert records using Jquery and Php not working. This Jquery script below does not add content to database using php. can someone help me fix that. Thanks [CODE] // API Here <script type="text/javascript"> $(document).ready(function(){ $.post('database.php', { auid: environment.app_host.auid, user_auid: environment.user.user_auid, access_token: access_token function(info){ $("#result").html(info); }); }); </script> </head> <body> <h3>Jquery data Submission in php</h3> <div id="result"></div> <br><br>
<?php // pdo connection require('db.php'); $x = $_POST['auid']; $y = $_POST['user_auid']; $z = $_POST['access_token']; $statement = $db->prepare('INSERT INTO tb_API (data1,data2,data3) values (:data1,:data2,:data3) '); $statement->execute(array( ':data1' => $x, ':data2' => $y, ':data3' => $z, )); echo "Success"; ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)