Click here to Skip to main content
15,882,658 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.



// API Here

  <script type="text/javascript">

$.post('database.php', {
    auid: environment.app_host.auid,
    user_auid: environment.user.user_auid,
    access_token: access_token

function(info){ $("#result").html(info);


  <h3>Jquery data Submission in php</h3>
<div id="result"></div>

  // pdo connection

   $x = $_POST['auid'];
  $y = $_POST['user_auid'];

  $z = $_POST['access_token'];

$statement = $db->prepare('INSERT INTO tb_API (data1,data2,data3) 
               (:data1,:data2,:data3)  ');
':data1' => $x,
':data2' => $y,
':data3' => $z,

echo "Success";

Dave Kreskowiak 12-Jul-15 20:22pm    
"Not working" is not a description of the problem. What DOES happen when you run the code? Any error messages?

1 solution

no error messages and the data could not be submitted
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900