0

this is what i am doing. I am incrementing php var through a function like:

<?php $j=1; ?>

jQuery('.mysubmitbuttin').click(function(){

increment();

});

function increment()
{
    var inc = '<?php echo $j=$j+1; ?>';
    alert(inc);
    return inc;
}

the alert inc showing 2 everytime. php var $j is not incrementing the value. why is it so?

Hassan Ali
  • 593
  • 1
  • 8
  • 26

1 Answers1

0

php-code is only executed once on the SERVER ! before you get the DOM-Element

Alexis Peters
  • 1,583
  • 1
  • 10
  • 17