Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

banking program deposit and withdrawal using ajax call

<!DOCTYPE html>
<html>

  <head>
    <script  src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  </head>

  <body>
    <div id="checking" class="account">
      <h2>Checking</h2>
      <div id="checkingBalance" class="balance">$0</div>
      <input id="checkingInput" class="input" type="text" value="0" placeholder="enter an amount" />
      <input id="checkingDeposit" class="deposit" type="button" value="Deposit" />
      <input id="checkingWithdraw" class="withdraw" type="button" value="Withdraw" />
    </div>
    <div id="savings" class="account">
      <h2>Savings</h2>
      <div id="savingsBalance" class="balance">$0</div>
      <input id="savingsInput" class="input" type="text" placeholder="enter an amount" value="0" />
      <input id="savingsDeposit" class="deposit" type="button" value="Deposit" />
      <input id="savingsWithdraw" class="withdraw" type="button" value="Withdraw" />
    </div>
    <script>
    $(function() {
      $("#checkingBalance").on("click", function() {
        var checkingBalance = parseInt($(this).text().replace("$", "")); 
        console.log("This is the checking balance. ", checkingBalance); 
        var deposit = parseInt($("#checkingInput").val()); 
        console.log("This is the deposit: " + deposit);
        var total = deposit + checkingBalance; 
        console.log("This is the total: " + total); 
        $("#checkingBalance").html("$" + total);
        if (total > 0) {
          $("body").removeClass("zero")
        }
      })
    });
  </script>
  </body>

</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: json2csv parse with flatten example javascript 
Javascript :: await reserved word testcafe using await in loop 
Javascript :: [myobj.key] [myobj[key]] [myobj["key"]] answer 
Javascript :: Trouble setting up sample table. “Could not find matching row model for rowModelType clientSide” 
Javascript :: how to calculate each row with on change table <td<input jquery 
Javascript :: define all jsdoc typedef in a seperate file 
Javascript :: javascript define variable 
Javascript :: java script num toSting syntax eror 
Javascript :: compare string camelcase and lowercase javascript 
Javascript :: eyeshot javascript version 
Javascript :: javascript datum addieren 
Javascript :: apollo graphql clearstore example 
Javascript :: contact form7 404 wp-json feedback 
Javascript :: js library for checking if two shapes overlap 
Javascript :: formatDoubl js 
Javascript :: Send redirect URL in the text body of mail using nodemailer 
Javascript :: how to make color squares in angular 
Javascript :: quill js server side delta 
Javascript :: selenium how to automate javascript dialogs 
Javascript :: $(document).ready( function(){ $("#titolo").append(" Ciao").FadeIn(1500); } ); 
Javascript :: how to iterate in array of array 
Javascript :: angular.json to war 
Javascript :: javaascript for unliking twitter 
Javascript :: cheditor wont open style material ui modal 
Javascript :: Uncaught ReferenceError: jQuery is not defined at (index): "405" 
Javascript :: atsby-plugin-tags npm 
Javascript :: javscript send ajax request only if submit is valid 
Javascript :: load a script after a button is pressed js 
Javascript :: how to post json to cloudwatch 
Javascript :: currentVal 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =