what i am trying to do is send a variable named num (numerical value) to a page named javas.php and then that value is displayed in a class on another php page, its quite complicated to understand, i know, but any help is appreciated. I need this to be as the value of num forms the basis of a sql query therefore the result needs to be posted to php, furthermore, the value of num is used to get the record of the row number "num".
$(".eventer button[name=lol]").click(function() {
console.log('clicked');
thisBtn = $(this);
parent = $(this).parent();
num = parent.data('num');
id = parent.data('id');
if(typeof num != 'number'){
num = 0;
}
$(this).attr('disabled', true);
$.ajax({
url: 'javas.php',
data: "num="+ ( num + 1 ) +"&id="+id,
success: function(data) {
console.log('Ajax success');
parent.data('num', ++num);
parent.next('.status').html(num);
thisBtn.attr('disabled', false); // reset
}
});
console.log('-- end');
});
This is what i have so far. Any solutions?
$.post('javas.php', { num: (num + 1), id: id }, function(data) {
console.log('Ajax success');
parent.data('num', ++num);
parent.next('.status').html(num);
thisBtn.attr('disabled', false); // reset
});