Results 1 to 2 of 2

Thread: ajax- jquery inserting 78 data instead of just one into database

  1. #1
    Join Date
    Aug 2013
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ajax- jquery inserting 78 data instead of just one into database

    this code above inserts the same content upto 70 times(ie into 70 rows) in a database instead of just once.

    please what could be the problem

    Code:
    <script src="jquery.min.js" type="text/javascript"></script>
      <script type="text/javascript">
       $(document).ready(function(){
    
    helpdesk.request('tickets',{ per_page: '90'}).then(function(data){
    $.each(data.tickets, function(index, ticket){
    
    
    // save to database
    
    $.post("save.php",
          {
    
    t_id: ticket_id,
    t_name: ticket_name
            },
            function(data,status){
             alert("Data: " + data + "\nStatus: " + status);
    
            });
    });
        });
    
       });
      </script>

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,035
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    What about the contents of the save.php file?
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Resolved JQuery Ajax - Posting to Database
    By Deadweight in forum JavaScript
    Replies: 3
    Last Post: 12-07-2013, 02:10 AM
  2. Replies: 0
    Last Post: 10-22-2010, 12:17 PM
  3. Resolved Ajax/jQuery Post Data not working ?
    By bennyy007 in forum JavaScript
    Replies: 0
    Last Post: 08-10-2009, 02:20 PM
  4. Posting data to a Ms Access database using Ajax
    By twardone in forum The lounge
    Replies: 0
    Last Post: 03-17-2008, 07:41 PM
  5. Inserting & Update into database?
    By hola in forum PHP
    Replies: 1
    Last Post: 04-18-2007, 02:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •