PDA

View Full Version : ajax- jquery inserting 78 data instead of just one into database



mutago
07-24-2015, 09:14 PM
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




<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>

Beverleyh
07-25-2015, 04:51 AM
What about the contents of the save.php file?