parse local json file
//using JQuery
$.getJSON("test.json", function(json) {
console.log(json); // this will show the info it in firebug console
});// pure javascript
let object;
let httpRequest = new XMLHttpRequest(); // asynchronous request
httpRequest.open("GET", "local/path/file.json", true);
httpRequest.send();
httpRequest.addEventListener("readystatechange", function() {
if (this.readyState === this.DONE) {
// when the request has completed
object = JSON.parse(this.response);
}
});
Also in JavaScript:
- how to get the index of an array in javascript
- javascript dispatch a custom event
- how to print numbers in javascript
- Finished. Please run Mix again.
- libuv nodejs
- Convert Characters into String Array in JavaScript
- javascript call php function with parameters
- pass variable to regrex literal notation javascript
- faher js
- materal ui react range slider
- datepicker in react
- switch case mdn
- stripe stripe js
- react native init project
- jquery scroll to top of div
- anagram program in javascript
- javascript filter
- js last index of
- how to make so chrome open closed tabs automatically
- To do validation for the textbox , radio button and dropdown using jquery
- take a screen shot of a image within a div using js
- get random element from string array java
- node red admin password setting
- js combine two arrays