jQuery and mySql index don't match
I have a problem with index-ing. In jQuery it's zero based, in mySql it starts with 1. It's probably impossible to make mysql index from 0, so I have to fix it in the jQuery code, which folllows:
- $(document).ready(function(){
-
- $("#tekst a").click(function() {
- var index = $('#tekst a').index(this);
- var klik = $('#glosy p:eq(' + index + ')').html().replace('(','').replace(')','');
- var addklik = ++klik;
- $.ajax({
- type: "POST",
- url: "ajax2.php",
- data: 'addklik=' + addklik + '&index=' + index,
- success: function(data){
- $('#glosy p:eq(' + index + ')').text('('+addklik+')');
-
- }
- });
-
- return false;
- });
-
- });
Any ideas?