Send money to player by username javascript
<p>I am using kongregate to fetch a users username</p>

<p><code>var username = kongregate.services.getUsername()</code></p>

<p>Now using this username I would like a way for players to send money they have to other users but im not exactly sure how my entire game is written in javascript and at this point theres absolutly no way I could switch over to PHP and use ajax so can this be done with javascript for example heres a little relevant code</p>

<pre class="lang-js prettyprint-override"><code>var playerName = document.getElementById("username").value;
var moneyAmt = document.getElementById("money").value;
var submitBtn = document.getElementById("sendMoney");

submitBtn.onclick = function(){
  if(Game.Player.money &gt;= moneyAmt){
    Game.Player.money -= moneyAmt;
    //Send Money along with playerName
  }
}

//User recieving
if(kongregate.services.getUsername() == playerName){
  Game.Player.money += moneyAmt;
}
</code></pre>

<pre class="lang-html prettyprint-override"><code>//Form for sending
&lt;form&gt;
  &lt;input type="text" id="username" placeholder="Enter players username"&gt;&lt;br&gt;
  &lt;input type="number" id="money" placeholder="Enter amount to send"&gt;
  &lt;input type="submit" id="sendMoney" value="Send"&gt;
&lt;/form&gt;
</code></pre>



<p>I know this is kinda difficult especially with javascript but I am out of options</p>