richarddunnebsc
Coder
I am trying to update an league table with game scores. On game start 0-0, games played, games drawn and pts won increase 1 for both teams. After a team scores, one team's draw becomes a win and gets 2 more points, goals for increases by 1, the other team's draw becomes a loss and loses a point, goals against increases by 1. I am trying to send the teams and scores to php for processing.
This is my code:
As far as dataType seems to be working. Any help appreciated.
This is my code:
As far as dataType seems to be working. Any help appreciated.
JSON:
document.getElementById("Home1Goals").innerText = 0;
document.getElementById("Away1Goals").innerText = 0;
$(document).on("click", "#Week1Game1Start", function() {
$.ajax({
method: "POST",
url: "Operations.php",
data: {"Week1Game1Home": "Home1Goals", "Week1Game1Away": "Away1Goals"},
dataType:"json",
success: function(data)
{
var result = JSON.parse(data);
alert(parsedJSON.canApprove);
if(data.statusCode==200)
{
alert('success');
}
}
});
});