class Stats extends Phaser.State {

	create() {
		this.totalScore = this.game.state.states['Main'].totalScore;
		this.enemyScore = this.game.state.states['Main'].enemiesPassed;
		this.coinScore = this.game.state.states['Main'].coinCounter;

    this.game.stage.backgroundColor = '#DFF4FF';

		let statsHeader = "STATS";
    let continuePhrase = "Tap to Continue";
    // let saved = "";
    // let score = function(){adds everything}
    this.statsHeaderText = this.game.add.text(650, 50, statsHeader, { font: "250px Revalia", textalign: "center"});
		this.continueText = this.game.add.text(820, 300, continuePhrase, { font: "50px Arial", textalign: "center"});
    this.savedText = this.game.add.text(820,300, saved, { font: "50px Arial", textalign: "center"});


		this.enemyScore = this.game.add.text(1000, 600, ("Enemies dodged: " + this.enemyScore), { font: "60px Arial", fill: "#fffff"});
		this.coinScore = this.game.add.text(1000, 700, ("Coins collected: " + this.coinScore), { font: "60px Arial", fill: "#fffff"});

		this.playerScore = this.game.add.text(1000, 800, ("Total Score: " + this.totalScore), { font: "60px Arial", fill: "#fffff"});
		this.sendButton = this.game.add.button(1000, 900, 'send', this.sendScore, this);

	}

	sendScore() {
		// this.playerName = prompt("Please enter your name", "Player");
		// STILL IN PROCESS
	}

  update() {
    if(this.game.input.activePointer.justPressed()) {
      $.ajax({
        // need to edit url accordingly
        url: "http://localhost:3000/scores",
        type: "post",
        dataType: "json",
        data: {
          username: "test",
          score: this.totalScore,
        },
        // success: () => {
        //   this.saved = "Saved Successfully!";
        // }
      })
      this.game.state.start('End');
    }

  }
}

export default Stats;

@@ -654,24 +654,27 @@
 nter%22%7D);%0A   
+ //
  this.savedT
@@ -1256,170 +1256,8 @@
 ) %7B%0A
-%09%09// this.playerName = prompt(%22Please enter your name%22, %22Player%22);%0A%09%09// STILL IN PROCESS%0A%09%7D%0A%0A  update() %7B%0A    if(this.game.input.activePointer.justPressed()) %7B%0A  
     
@@ -1271,18 +1271,16 @@
 %7B%0A      
-  
 // need 
@@ -1303,18 +1303,16 @@
 rdingly%0A
-  
       ur
@@ -1352,18 +1352,16 @@
 ,%0A      
- 
- 
 type: %22p
@@ -1362,26 +1362,24 @@
 pe: %22post%22,%0A
-  
       dataTy
@@ -1400,18 +1400,16 @@
     
- 
- 
 data: %7B%0A
     
@@ -1404,18 +1404,16 @@
 data: %7B%0A
-  
         
@@ -1426,26 +1426,24 @@
 me: %22test%22,%0A
-  
         scor
@@ -1468,18 +1468,16 @@
 ,%0A      
-  
 %7D,%0A     
@@ -1481,100 +1481,81 @@
     
-  // success: () =%3E
+%7D)%0A%09%7D%0A%0A  update()
  %7B%0A    
- 
-   //   this.saved = %22Saved Successfully!%22;%0A        // %7D%0A      %7D)
+if(this.game.input.activePointer.justPressed()) %7B
 %0A   

edit ajax request in sendScore callback function