$(".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');
});
How would i change this function to a $.post function, keeping all the button attributes etc.
I need the value of num to be sent to javas.php and then that data to be echoed in the status class.
would this work:
see:
http://api.jquery.com/jQuery.post/