Hi i am just trying to make a simple Ajax call using jQuery
this is my JavaScript:
//Starts the game
function startGame() {
$.ajax({
type: "POST",
url: "Default.aspx/StartGame"
});
}
my button:
<input type="image" value="twist..." src="images/play.png" class="playButton" onclick="startGame();return false;" />
and code behind:
public partial class Default : Page
{
private static GameEngine GameEngine
{
get { return new GameEngine();}
}
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public void StartGame()
{
GameEngine.StartToPlay();
}
}
when I debug the code in Visual Studio the method StartGame
is never called.
Can anyone explain to me what's the problem?