I am writing a program that calls a PHP function inside a Jquery script. The code works for the first time around but when I attempt to use the same PHP again it doesn't work.
Here is the code:
$("#left").click(function() {
$("#Left").text("You chose to go left");
$("#Right").remove("#Right");
$("#result").html("<?php left(); ?>");
});
$("#right").click(function() {
$("#Left").remove("#Left");
$("#Right").text("You chose to go Right");
$("#result").html("<?php right(); ?>");
});
$("#fight").click(function() {
$("#Fight").text("You chose to fight");
$("#Run").remove("#Run");
});
$("#run").click(function() {
$("#Fight").remove("#Fight");
$("#Run").text("You chose to run");
});
Left and Right work just fine, but fight and run don't work for someone reason.