Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

insert records using jquery and php not working


This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 mutago


    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 478 posts

Posted 12 July 2015 - 12:56 PM


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.

<!DOCTYPE html>
<script src="jquery.js"></script>
// 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";


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download