banking program deposit and withdrawal using ajax call
JavaScript
<!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>
Also in JavaScript:
- Title
- .change() in pure js
- Category
- JavaScript
- Title
- how to display date in javascript
- Category
- JavaScript
- Title
- defining props in react
- Category
- JavaScript
- Title
- datatable on error.dt
- Category
- JavaScript
- Title
- how to print a array js
- Category
- JavaScript
- Title
- class javascript
- Category
- JavaScript
- Title
- abstraction in javascript
- Category
- JavaScript
- Title
- input set variable angular
- Category
- JavaScript
- Title
- how to mass comment in p5
- Category
- JavaScript
- Title
- discord js bot leave voice channel
- Category
- JavaScript
- Title
- conditional rendering with radio buttons
- Category
- JavaScript
- Title
- Angular watching for changes in $http.pendingRequests from directive
- Category
- JavaScript
- Title
- ad data to js object
- Category
- JavaScript
- Title
- get args nodejs
- Category
- JavaScript
- Title
- .join javascript
- Category
- JavaScript
- Title
- get value javascript
- Category
- JavaScript
- Title
- add char in specific index stirng javascript
- Category
- JavaScript
- Title
- how to add property to object in javascript
- Category
- JavaScript
- Title
- how to split an array in javascript
- Category
- JavaScript
- Title
- bq show pretty json
- Category
- JavaScript
- Title
- check palindrome js
- Category
- JavaScript
- Title
- how to assign same value of a key to 2 different keys in output JSON jolt
- Category
- JavaScript
- Title
- adding delay in javascript foreach loop
- Category
- JavaScript
- Title
- how to create a server in node js
- Category
- JavaScript
- Title
- how to run function after animation complete jquery
- Category
- JavaScript
- Title
- how to create request body javascript
- Category
- JavaScript
- Title
- how to access array datat in class component react
- Category
- JavaScript
- Title
- bootstrap 4 open tab when opening modal
- Category
- JavaScript
- Title
- how to use componentdidmount in functional component
- Category
- JavaScript
- Title
- how to convert time to am pm in javascript
- Category
- JavaScript
- Title
- icon shwoing a box react native vector icons
- Category
- JavaScript
- Title
- check if function exists javascript
- Category
- JavaScript
- Title
- create react app deployment heroku
- Category
- JavaScript
- Title
- angular flex layout
- Category
- JavaScript
- Title
- background-image url not working
- Category
- JavaScript
- Title
- go to anchor jquery
- Category
- JavaScript
- Title
- how to attach javascript to html
- Category
- JavaScript
- Title
- how to rescale a canvas in html5 without blurrriness
- Category
- JavaScript
- Title
- event listener on parent not on childjavascript
- Category
- JavaScript
- Title
- flatten nested object js
- Category
- JavaScript
- Title
- export apk react native
- Category
- JavaScript
- Title
- how to update angular version
- Category
- JavaScript
- Title
- fizz buzz javascript
- Category
- JavaScript
- Title
- electron Uncaught ReferenceError: require is not defined at recorder.js:1
- Category
- JavaScript
- Title
- deny ready jquery
- Category
- JavaScript
- Title
- get string of element
- Category
- JavaScript
- Title
- button click function in js
- Category
- JavaScript
- Title
- google sign in in firebase react
- Category
- JavaScript
- Title
- adding a variable to a string without using + in javascript
- Category
- JavaScript
- Title
- dropzone add download button addedfile
- Category
- JavaScript
- Title
- int cating javascript
- Category
- JavaScript
- Title
- iterate through list javascript
- Category
- JavaScript
- Title
- how to validate an email address in javascript
- Category
- JavaScript
- Title
- export aab bundle react native android
- Category
- JavaScript
- Title
- how to check string uppercase or lowersace using regex javascript
- Category
- JavaScript
- Title
- how to make a deep copy in javascript
- Category
- JavaScript
- Title
- autocomplete typeahead ajax
- Category
- JavaScript
- Title
- Angularjs datetime
- Category
- JavaScript
- Title
- get the value of a checkbox jquery
- Category
- JavaScript
- Title
- how to get session javascript ws3schools
- Category
- JavaScript
- Title
- get today's date javascript
- Category
- JavaScript
- Title
- get client timezone offset JavaScript
- Category
- JavaScript
- Title
- iso to date javascript
- Category
- JavaScript
- Title
- how to add array numbers in javascript
- Category
- JavaScript
- Title
- array sort by key javascript
- Category
- JavaScript
- Title
- google maps api javascript
- Category
- JavaScript
- Title
- disabling submit button until all fields have values
- Category
- JavaScript
- Title
- create array with specific size javascript
- Category
- JavaScript
- Title
- for javascript delay
- Category
- JavaScript
- Title
- Disable Multiple Form Submits with Vanilla JavaScript
- Category
- JavaScript
- Title
- how to import a json string from a file in typescript
- Category
- JavaScript
- Title
- javascript clearinterval
- Category
- JavaScript
- Title
- inbound email sendgrid cloud functions
- Category
- JavaScript
- Title
- javascript array of objects
- Category
- JavaScript
- Title
- get keys of object js
- Category
- JavaScript
- Title
- Expected an assignment or function call and instead saw an expression
- Category
- JavaScript
- Title
- how to write a program that tests whether it's before noon and alert “Its AM” else “its PM” in javascript
- Category
- JavaScript
- Title
- how to code print in javascript
- Category
- JavaScript
- Title
- disregard empty field in array
- Category
- JavaScript
- Title
- get text selected option jquery
- Category
- JavaScript
- Title
- format number thousands k javascript
- Category
- JavaScript
- Title
- clearinterval javascript
- Category
- JavaScript
- Title
- how to write a program that alerts the current month in words in javascript
- Category
- JavaScript
- Title
- d3 disable context menu
- Category
- JavaScript
- Title
- closure javascript
- Category
- JavaScript
- Title
- javascript assignment operator if undefined
- Category
- JavaScript
- Title
- how to draw a flower in javascript
- Category
- JavaScript
- Title
- count occurrences of character in string javascript
- Category
- JavaScript
- Title
- angular event emitter
- Category
- JavaScript
- Title
- jason rpc reactjs
- Category
- JavaScript
- Title
- hide show div jquery
- Category
- JavaScript
- Title
- auto refresh page javascript
- Category
- JavaScript
- Title
- javascript class inheritance
- Category
- JavaScript
- Title
- how to animate a flash in jquery
- Category
- JavaScript
- Title
- comment in react
- Category
- JavaScript
- Title
- Appending the option element using jquery each function
- Category
- JavaScript
- Title
- addEventListener
- Category
- JavaScript
- Title
- how to make an async function
- Category
- JavaScript
- Title
- how to set text for label in jquery
- Category
- JavaScript
- Title
- javascript array map stack
- Category
- JavaScript