jQuery(document).ready(function ($) {
$("#coin").click(function () {
var flipResult = Math.random();
$("#coin").removeClass();
setTimeout(function () {
var coinResult = " Heads"
if (flipResult <= 0.5) {
$("#coin").addClass("heads");
console.log(coinResult);
} else {
var coinResult = "Tails"
$("#coin").addClass("tails");
console.log(coinResult);
}
$('#table_of_results').append('<tr><td>' + coinResult + '</td></tr>');
for(i=0;i<1;i++){
$.ajax({ type:"post", url:"server.php?p=add", data: coinResult, datatype: "text", success: function(postresult){ console.log("success");} })
}
Got the coin to flip and append table element correctly but it wont post to server any idea why?