Posts
Showing posts with the label JavaScript
How do I make an HTTP request in Javascript?
- Get link
- X
- Other Apps
To make an HTTP request in JavaScript, you can use the `XMLHttpRequest` object, or more commonly nowadays, use the `fetch` API, which provides a more modern and simpler way to handle HTTP requests. Using the Fetch API (Recommended): The Fetch API is built into modern browsers and allows you to make network requests with a Promise-based approach. Here's how you can use it to make a simple HTTP GET request: // javascript // Making a GET request using Fetch API fetch('https://api.example.com/data') .then(response => response.json()) // Parse the response as JSON .then(data => { console.log(data); // Process the data returned by the server }) .catch(error => { console.error('Error:', error); }); You can also use `async/await` syntax to make it more readable: // javascript async function fetchData() { try { const response = await fetch('https://api.example.com/data'); const data = await response.json(); console.log(d...
In JavaScript, Sign Up Form Validation & Send Via Email
- Get link
- X
- Other Apps
In JavaScript, Capture Pizza Orders With Error Handling
- Get link
- X
- Other Apps
<!DOCTYPE> <html lang="en-US"> <head> <title>Pizza Order</title> <style> label.error{ color:red; } </style> </head> <body> <p> <label><select id="size"> <option value=""></option> <option value="10.0">SMALL - $10.00</option> <option value="12.5">MEDIUM - $12.50</option> <option value="15.0">LARGE - $15.00</option> </select> Pizza Size</label> </p> <p> <label><input type="checkbox" name="topping" value="2.0"/>Extra Cheese</label> <label><input type="checkbox" name="topping" value="0.6"/>Red onions</label> <label><input type="checkbox" name="topping" value=...
In JavaScript, Compute Gross Salary Of Salesperson Based On Weekly Sales
- Get link
- X
- Other Apps
<!DOCTYPE html> <html lang="en-US"> <head> <title>Weekly Salary</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </head> <body onload="showSalaries();"> <h1>Weekly Salary</h1> <form onsubmit="newSale(this);return false;" autocomplete="off"> <label>Gross Weekly Sales<label> <input name="sales" required="" pattern="^\d*$" title="Positive numbers only!" autofocus=""/> <button>Submit</button> </form> <table border="1" cellspacing="0" cellpadding="5" style="margin-top:10px;"> <thead> <tr> <th>Salaries</th> <th>No# of Salesperson</th> </tr> </thead> <tbody id="out"/> </table> <scr...
✔ HTML 5 ⚡ How to read excel file with JavaScript 🔥 Tecq Mate Tutorials ✌
- Get link
- X
- Other Apps
How to read excel file with HTML 5 JavaScript? <input type="file" onchange="process(this.files[0])"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.13.5/xlsx.full.min.js" type="text/javascript"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.13.5/jszip.js" type="text/javascript"></script> <script type="text/javascript"> function process(file) { var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.xls|.xlsx)$/i; if (regex.test(file.name)) { if (typeof (FileReader) != "undefined") { var reader = new FileReader(); if (reader.readAsBinaryString) { reader.onload = function (e) { loadData(e.target.result); }; reader.readAsBinaryString(file); } else { reader.onload = function ...