JSON (JavaScript Object Notation) is a lightweight data format that is easy for humans to read and write and for machines to parse and generate. It is built on two structures: a collection of name/value pairs and an ordered list of values. JSON is primarily used to transmit data between a web server and web application, and it is the most common data format used for asynchronous browser/server communication using AJAX.
JavaScript is a scripting language originally designed for web browsers but now used everywhere. It has dynamic typing and supports object-oriented, imperative, and functional programming. JavaScript was created in 1995 and standardized in 1999. It is now the most popular language on GitHub. JavaScript can be used to build interactive web pages, desktop applications, server-side applications, IoT applications, and real-time applications. The core data types in JavaScript are Number, String, Boolean, Object, Function, Array, Date, and Regular Expressions. JavaScript supports features like variables, flow control, error handling, debugging, and JSON for data exchange.
AngularJS is a JavaScript framework for building dynamic web applications. It augments HTML with custom attributes and directives to bind data and behaviors to the DOM. Key features include two-way data binding, reusable components, dependency injection, routing, and templating. AngularJS uses an MVC or MVVM pattern, with scopes providing the view model. The framework enhances HTML, encourages test-driven development, and makes single page apps possible.
JSON is a lightweight data-interchange format that is easy for humans and machines to read and write. It is built on two structures: a collection of name/value pairs and an ordered list of values. A JSON object holds properties whose names are strings, and values can be strings, numbers, booleans, arrays, or null. JSON is commonly used to transmit data between a server and web application, without requiring a page refresh.
JavaScript can dynamically manipulate the content, structure, and styling of an HTML document through the Document Object Model (DOM). The DOM represents an HTML document as nodes that can be accessed and modified with JavaScript. Common tasks include dynamically creating and adding elements, handling user events like clicks, and updating content by accessing DOM elements by their id or other attributes.
JavaScript is a client-side scripting language that can be inserted into HTML pages to make them interactive. It allows dynamic validation of forms, changing HTML element properties like visibility, and reacting to user events like clicks or form submissions. The Document Object Model (DOM) represents an HTML or XML document as a tree structure, allowing JavaScript to programmatically access and modify the content, structure, and styling of the document. Common built-in JavaScript objects include String, Date, Array, Math, and Boolean, which provide properties and methods for manipulating text, dates, lists of values, numbers, and true/false values.
This document discusses JavaScript events and event listeners. It begins with an introduction that defines events as notifications that specific actions occurred, like user or browser actions. Event handlers are scripts that are executed in response to events. Events can be used to trigger JavaScript code that responds to user interactions. The document then provides examples of common event types like onclick, onsubmit, onmouseover, onmouseout, focus, and blur. It also discusses how to add and remove event listeners using addEventListener() and removeEventListener() methods. The document concludes with an example demonstrating how events can be used to change an HTML element in response to user clicks.
JSON (JavaScript Object Notation) is an independent data exchange format. It is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. In JSON, a data structure is a key / value pair. It is a subset of the JavaScript Specification (ECME-Script) and is therefore directly in JavaScript.
This document provides an introduction to JavaScript and its uses for web programming. It explains that JavaScript is a client-side scripting language that allows web pages to become interactive. Some key points covered include:
- JavaScript can change HTML content, styles, validate data, and make calculations.
- Functions are blocks of code that perform tasks when invoked by events or called in code.
- Events like clicks or keyboard presses trigger JavaScript code.
- The DOM (Document Object Model) represents an HTML document that JavaScript can access and modify.
- Forms and user input can be accessed and processed using the DOM.
- Programming flow can be controlled with conditional and loop statements.
-
XPath is a language for selecting nodes in an XML document. It uses path expressions that navigate the hierarchical structure of XML. Path expressions select nodes or node-sets using steps, axes, predicates and wildcards. XPath is commonly used with XSLT to transform XML documents into other formats. It contains functions like position(), count(), and last() to retrieve information about nodes.
This document provides an overview of JavaScript basics including variables, data types, operators, conditional statements, loops, functions, arrays, and error handling. It explains JavaScript syntax, how to include JavaScript code in HTML pages, and commonly used statements like if/else, switch case, while and for loops. It also covers JavaScript functions, returning values from functions, and printing pages. The document describes JavaScript strings and array objects, and their associated methods. Finally, it discusses different types of errors in JavaScript like syntax errors, runtime errors, and logical errors.
This document provides an overview of HTML and CSS topics including:
- A brief history of HTML and CSS standards from 1990 to present.
- Descriptions of common HTML elements like <body>, <head>, <img>, <a>, and lists.
- Explanations of CSS concepts like selectors, properties, units, positioning, and layout fundamentals.
- Details on CSS topics like the box model, centering content, semantic HTML, and flexbox.
The document serves as a course outline or reference for learning HTML and CSS fundamentals.
about this presentation:
1) this presentation was a quickie for non-tech employees, who wanted a basic understanding of html/css, as it related to a white-label SAAS product;
2) the back-end/front-end definitions relate to the specific application (it's inaccurate if node.js is in the picture)
Objects in JavaScript can be created using object literals, the new keyword, or Object.create(). Objects are collections of properties and methods that are mutable and manipulated by reference. Arrays are objects that represent ordered collections of values of any type and are created using array literals or the Array constructor. Common array methods include concat, join, pop, push, reverse, and sort. The Math object provides common mathematical functions like pow, round, ceil, floor, random, and trigonometric functions.
JavaScript - An Introduction is a beginner's guide to JavaScript. It starts with very basic level and goes to intermediate level. You'll be introduced with every language constructs, Event handling, Form handling and AJAX which is supported by JavaScript with XMLHttpRequest object. This XHR object is discussed in enough detail so that you can understand how the underlying AJAX functionality works in jQuery. At the end it discusses advance concepts and library build on/around JavaScript.
This document is a presentation about JavaScript that covers what JavaScript is, where it came from, and what it can do. It introduces JavaScript as a scripting language that is easy to use and learn and runs in web browsers. The presentation explains that JavaScript is unrelated to Java but borrows some naming conventions. It provides overviews of JavaScript basics like variables, operators, and functions, as well as more advanced topics like objects, events, and DOM manipulation.
The document provides an overview of jQuery including:
- What jQuery is and its main features like DOM manipulation and AJAX
- How to include jQuery in an HTML document and basic usage syntax
- jQuery selectors to find elements and filters to refine selections
- Common jQuery methods for manipulating attributes, events, HTML, CSS, and more
- Examples of using various jQuery functions and concepts
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write and for machines to parse and generate. It is built on two structures: a collection of name/value pairs and an ordered list of values. JSON is primarily used to transmit data between a server and web application, providing an alternative to XML. It can represent numbers, strings, ordered sequences of values (arrays), and collections of name/value pairs (objects).
This document provides a tutorial on JSON (JavaScript Object Notation). It begins with a basic JSON example of an employee data object with an array of records. It then explains that JSON is a lightweight data format that is easy to read/write and can be parsed by JavaScript. The document covers JSON syntax rules, data types, objects, arrays, and how JSON uses JavaScript syntax. It provides examples of using JSON with HTTP requests, function files, and SQL queries. The goal is to teach how to read JSON data from a web server and display it in a web page.
This presentation deals with every possible topics under JSON (JavaScript Object Notation) which every web developers should know.
It is presented by Rajasekhar who works at United Online as a Web Developer
This document provides an overview of JSON (JavaScript Object Notation) including its syntax, values, objects, arrays, and uses for exchanging and storing data. JSON is a lightweight data format that is easy for humans to read and write and easy for machines to parse and generate. The document also discusses using JSON with XMLHttpRequest to make HTTP requests to a web server and retrieve JSON data to display on a web page without reloading.
This document provides information about JSON (JavaScript Object Notation) including:
1. What JSON is and how it is used to structure and exchange data between web applications.
2. The syntax rules of JSON including how data is separated into name/value pairs within curly braces and square brackets.
3. Examples of JSON syntax including objects, arrays, and accessing JSON data using dot notation.
4. How JSON differs from JavaScript objects and how to convert between the two formats using JSON.parse() and JSON.stringify() methods.
A Higher-Order Data Flow Model for Heterogeneous Big DataSimon Price
Paper presentation at IEEE Big Data 2013 conference, Santa Clara, California. We introduce a data flow model that supports highly parallelisable design patterns and also has useful properties for analysing data serially over extended time periods without requiring traditional Big Data computing facilities.
The model ranges over a class of higher-order relations which are sufficiently expressive to represent a wide variety of unstructured, semi-structured and structured data. Using JSONMatch, our web service implementation of the model, we show that the combination of this model and higher-order representation provides a powerful and extensible framework that is particularly well suited to analysing Big Variety data in a web application context.
AJAX allows updating parts of a web page without reloading the entire page. It uses the XMLHttpRequest object to asynchronously send and receive data from a web server in the background. Common techniques include using JavaScript and DOM manipulation to update specific elements on a page based on the asynchronous response received in JSON, XML, HTML or plain text format from the server. Popular sites like Gmail, Google Maps, and YouTube use AJAX to provide dynamic and interactive experiences on the web.
Understand about what JSON is
Understand the difference between JSON and XML
Understand the context of using JSON with AJAX
Know how to read and write JSON data using PHP
The document provides an overview of JSON (JavaScript Object Notation) including its syntax, structure, and common uses. JSON is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is built on two structures: a collection of name/value pairs and an ordered list of values. JSON is primarily used to transmit data between a web server and web application.
This document provides an overview of working with JSON documents. It discusses JSON structure, validating JSON, querying and transforming JSON, and converting between JSON and XML formats. Validation can check for well-formedness and validate against a JSON schema. JSON can be queried using pointers, JSONiq, or XPath, and transformed with JavaScript, XSLT, or XQuery. Conversion between JSON and XML can be done programmatically or with online tools.
This document provides an introduction to JSON (JavaScript Object Notation), including what it is, its data structure, how to send and receive JSON data at both the client and server sides, and resources for further information. The key points covered are:
- JSON is a lightweight data format that is easy for humans and machines to read/write and is independent of programming languages.
- JSON data is structured as either a collection of name/value pairs (objects) or an ordered list of values (arrays).
- JSON can be converted to and from JavaScript objects using functions like eval() and JSON.parse().
- At the server, JSON data can be generated from objects and sent to clients, then parsed at the
JSON is a lightweight data-interchange format that is easy for humans to read and write and for machines to parse and generate. It is built on two structures: a collection of name/value pairs and an ordered list of values. JSON is text-based and language independent, yet closely resembles JavaScript object syntax. It is used primarily to transmit data between a server and web application, serving as an alternative to XML. Compared to XML, JSON is simpler, faster and easier to use.
JSON is a lightweight data format that is easy for humans to read and write and easy for machines to parse and generate. It is used to transmit data between a server and web application, as an alternative to XML. JSON can represent two basic structures - a collection of name/value pairs and an ordered list of values. Resources are provided to help developers work with JSON in JavaScript and Java.
This document discusses JSON (JavaScript Object Notation) and its role as a lightweight data interchange format, particularly for use in AJAX applications. It provides an overview of JSON's syntax and design, describing how it represents common data types like strings, numbers, objects, and arrays. It also addresses some criticisms of JSON and potential extensions to make it more flexible.
Slides for Tom Marrs BJUG talk on 2/12/2013. See http://boulderjug.org/2013/01/tuesday-february-12-2013-a-night-with-tom-marrs-covering-json-and-rest.html
JSON is a lightweight data format used to store and transport data between a server and web page. It stands for JavaScript Object Notation. JSON syntax follows JavaScript object syntax rules - data is in name/value pairs within curly braces for objects and square brackets for arrays. When exchanging data between a browser and server, it can only be text, so JSON text can be converted to JavaScript objects on the browser and back, allowing work with data as JavaScript objects without parsing. Arrays in JSON hold multiple objects within square brackets.
JSON Fuzzing: New approach to old problemstitanlambda
The document describes a new approach to JSON fuzzing developed by the authors. It notes that existing fuzzing tools do not support JSON format testing. The authors extended an existing Firefox addon to add JSON parsing and fuzzing capabilities. This allows converting a JSON request to name-value pairs for fuzzing, fuzzing the values, converting back to JSON format and sending to the application. A demo is provided and future work discussed, such as supporting different JSON formats and integrating the technique into other tools.
Presentation on various definitions for JSON including JSON-RPC, JSPON, JSON Schema, JSONP and tools for working these definitions including Persevere client and server..
This document discusses JSON (JavaScript Object Notation) as a lightweight data-interchange format. It describes JSON as a text-based format that is easy for humans to read and write and for machines to parse and generate. The document outlines JSON's basic syntax including objects, arrays, strings, numbers, and other values, and explains how JSON became widely adopted as a way to transmit data in web applications.
JSON is a lightweight data interchange format that is easy for humans to read and write and for machines to parse and generate. It is built on two structures: a collection of name/value pairs and an ordered list of values. JSON can be used to encode data for storage and transport in web applications, including as a replacement for XML in AJAX calls. PHP provides json_encode() and json_decode() functions to convert between JSON and PHP values, making it easy to work with JSON data in PHP applications and web services.
Slide Presentation from a Doctoral Virtual Open House presented on June 30, 2024 by staff and faculty of Capitol Technology University
Covers degrees offered, program details, tuition, financial aid and the application process.
Principles of Roods Approach!!!!!!!.pptxibtesaam huma
Principles of Rood’s Approach
Treatment technique used in physiotherapy for neurological patients which aids them to recover and improve quality of life
Facilitatory techniques
Inhibitory techniques
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894PECB
As artificial intelligence continues to evolve, understanding the complexities and regulations regarding AI risk management is more crucial than ever.
Amongst others, the webinar covers:
• ISO/IEC 42001 standard, which provides guidelines for establishing, implementing, maintaining, and continually improving AI management systems within organizations
• insights into the European Union's landmark legislative proposal aimed at regulating AI
• framework and methodologies prescribed by ISO/IEC 23894 for identifying, assessing, and mitigating risks associated with AI systems
Presenters:
Miriama Podskubova - Attorney at Law
Miriama is a seasoned lawyer with over a decade of experience. She specializes in commercial law, focusing on transactions, venture capital investments, IT, digital law, and cybersecurity, areas she was drawn to through her legal practice. Alongside preparing contract and project documentation, she ensures the correct interpretation and application of European legal regulations in these fields. Beyond client projects, she frequently speaks at conferences on cybersecurity, online privacy protection, and the increasingly pertinent topic of AI regulation. As a registered advocate of Slovak bar, certified data privacy professional in the European Union (CIPP/e) and a member of the international association ELA, she helps both tech-focused startups and entrepreneurs, as well as international chains, to properly set up their business operations.
Callum Wright - Founder and Lead Consultant Founder and Lead Consultant
Callum Wright is a seasoned cybersecurity, privacy and AI governance expert. With over a decade of experience, he has dedicated his career to protecting digital assets, ensuring data privacy, and establishing ethical AI governance frameworks. His diverse background includes significant roles in security architecture, AI governance, risk consulting, and privacy management across various industries, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: June 26, 2024
Tags: ISO/IEC 42001, Artificial Intelligence, EU AI Act, ISO/IEC 23894
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
The membership Module in the Odoo 17 ERPCeline George
Some business organizations give membership to their customers to ensure the long term relationship with those customers. If the customer is a member of the business then they get special offers and other benefits. The membership module in odoo 17 is helpful to manage everything related to the membership of multiple customers.
Webinar Innovative assessments for SOcial Emotional SkillsEduSkills OECD
Presentations by Adriano Linzarini and Daniel Catarino da Silva of the OECD Rethinking Assessment of Social and Emotional Skills project from the OECD webinar "Innovations in measuring social and emotional skills and what AI will bring next" on 5 July 2024
Beyond the Advance Presentation for By the Book 9John Rodzvilla
In June 2020, L.L. McKinney, a Black author of young adult novels, began the #publishingpaidme hashtag to create a discussion on how the publishing industry treats Black authors: “what they’re paid. What the marketing is. How the books are treated. How one Black book not reaching its parameters casts a shadow on all Black books and all Black authors, and that’s not the same for our white counterparts.” (Grady 2020) McKinney’s call resulted in an online discussion across 65,000 tweets between authors of all races and the creation of a Google spreadsheet that collected information on over 2,000 titles.
While the conversation was originally meant to discuss the ethical value of book publishing, it became an economic assessment by authors of how publishers treated authors of color and women authors without a full analysis of the data collected. This paper would present the data collected from relevant tweets and the Google database to show not only the range of advances among participating authors split out by their race, gender, sexual orientation and the genre of their work, but also the publishers’ treatment of their titles in terms of deal announcements and pre-pub attention in industry publications. The paper is based on a multi-year project of cleaning and evaluating the collected data to assess what it reveals about the habits and strategies of American publishers in acquiring and promoting titles from a diverse group of authors across the literary, non-fiction, children’s, mystery, romance, and SFF genres.
Satta Matka Dpboss Kalyan Matka Results Kalyan ChartMohit Tripathi
SATTA MATKA DPBOSS KALYAN MATKA RESULTS KALYAN CHART KALYAN MATKA MATKA RESULT KALYAN MATKA TIPS SATTA MATKA MATKA COM MATKA PANA JODI TODAY BATTA SATKA MATKA PATTI JODI NUMBER MATKA RESULTS MATKA CHART MATKA JODI SATTA COM INDIA SATTA MATKA MATKA TIPS MATKA WAPKA ALL MATKA RESULT LIVE ONLINE MATKA RESULT KALYAN MATKA RESULT DPBOSS MATKA 143 MAIN MATKA KALYAN MATKA RESULTS KALYAN CHART
Kalyan Matka Kalyan Result Satta Matka Result Satta Matka Kalyan Satta Matka Kalyan Open Today Satta Matka Kalyan
Kalyan today kalyan trick kalyan trick today kalyan chart kalyan today free game kalyan today fix jodi kalyan today matka kalyan today open Kalyan jodi kalyan jodi trick today kalyan jodi trick kalyan jodi ajj ka.
Integrated Marketing Communications (IMC)- Concept, Features, Elements, Role of advertising in IMC
Advertising: Concept, Features, Evolution of Advertising, Active Participants, Benefits of advertising to Business firms and consumers.
Classification of advertising: Geographic, Media, Target audience and Functions.
Delegation Inheritance in Odoo 17 and Its Use CasesCeline George
There are 3 types of inheritance in odoo Classical, Extension, and Delegation. Delegation inheritance is used to sink other models to our custom model. And there is no change in the views. This slide will discuss delegation inheritance and its use cases in odoo 17.
Still I Rise by Maya Angelou
-Table of Contents
● Questions to be Addressed
● Introduction
● About the Author
● Analysis
● Key Literary Devices Used in the Poem
1. Simile
2. Metaphor
3. Repetition
4. Rhetorical Question
5. Structure and Form
6. Imagery
7. Symbolism
● Conclusion
● References
-Questions to be Addressed
1. How does the meaning of the poem evolve as we progress through each stanza?
2. How do similes and metaphors enhance the imagery in "Still I Rise"?
3. What effect does the repetition of certain phrases have on the overall tone of the poem?
4. How does Maya Angelou use symbolism to convey her message of resilience and empowerment?
Views in Odoo - Advanced Views - Pivot View in Odoo 17Celine George
In Odoo, the pivot view is a graphical representation of data that allows users to analyze and summarize large datasets quickly. It's a powerful tool for generating insights from your business data.
The pivot view in Odoo is a valuable tool for analyzing and summarizing large datasets, helping you gain insights into your business operations.
2. What is JSON?
• JSON stands for JavaScript Object Notation
• JSON is a lightweight data-interchange format
• JSON is language independent *
• JSON is "self-describing" and easy to understand
• JSON is a syntax for storing and exchanging data.
• JSON is an easier-to-use alternative to XML.
infobizzs.com
3. JSON Example<!DOCTYPE html>
<html>
<body>
<h2>JSON Object Creation in JavaScript</h2>
<p id="demo"></p>
<script>
var text = '{"name":"John Johnson","street":"Oslo West 16","phone":"555 1234567"}';
var obj = JSON.parse(text);
document.getElementById("demo").innerHTML =
obj.name + "<br>" +
obj.street + "<br>" +
obj.phone;
</script>
</body>
</html> infobizzs.com
5. Much Like XML Because
• Both JSON and XML is "self describing" (human readable)
• Both JSON and XML is hierarchichal (values within values)
• Both JSON and XML can be parsed and used by lots of programming languages
• Both JSON and XML can be fetched with an XMLHttpRequest
Much Unlike XML Because
• JSON doesn't use end tag
• JSON is shorter
• JSON is quicker to read and write
• JSON can use arrays
• The biggest difference is:
XML has to be parsed with an XML parser, JSON can be parsed by a standard JavaScript function.
infobizzs.com
6. Why JSON?
For AJAX applications, JSON is faster and easier than XML:
• Using XML
• Fetch an XML document
• Use the XML DOM to loop through the document
• Extract values and store in variables
• Using JSON
• Fetch a JSON string
• JSON.Parse the JSON string
infobizzs.com
7. JSON Syntax
The JSON syntax is a subset of the JavaScript syntax.
• JSON Syntax Rules
JSON syntax is derived from JavaScript object notation syntax:
• Data is in name/value pairs
• Data is separated by commas
• Curly braces hold objects
• Square brackets hold arrays
infobizzs.com
8. JSON Data - A Name and aValue
• JSON data is written as name/value pairs.
• A name/value pair consists of a field name (in double quotes), followed by a colon, followed
by a value:
"firstName":"John"
• JSONValues
• JSON values can be:
• A number (integer or floating point)
• A string (in double quotes)
• A Boolean (true or false)
• An array (in square brackets)
• An object (in curly braces)
• null
infobizzs.com
9. JSON Objects
• JSON objects are written inside curly braces.
• Just like JavaScript, JSON objects can contain multiple name/values pairs:
{"firstName":"John", "lastName":"Doe"}
JSON Arrays
• JSON arrays are written inside square brackets.
• Just like JavaScript, a JSON array can contain multiple objects:
"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName":"Jones"}
]
infobizzs.com
10. JSON Uses JavaScript Syntax
• Because JSON syntax is derived from JavaScript object notation, very little
extra software is needed to work with JSON within JavaScript.
• With JavaScript you can create an array of objects and assign data to it, like
this:
var employees = [
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName": "Jones"}
];
infobizzs.com
11. JSON HowTo
• A common use of JSON is to read data from a web server, and display the data in a web
page.
• For simplicity, this can be demonstrated by using a string as input (instead of a file).
• JSON Example - Object From String
• Create a JavaScript string containing JSON syntax:
var text = '{ "employees" : [' +
'{ "firstName":"John" , "lastName":"Doe" },' +
'{ "firstName":"Anna" , "lastName":"Smith" },' +
'{ "firstName":"Peter" , "lastName":"Jones" } ]}';
infobizzs.com
12. • JSON syntax is a subset of JavaScript syntax.
• The JavaScript function JSON.parse(text) can be used to convert a JSON text into a
JavaScript object:
var obj = JSON.parse(text);
Use the new JavaScript object in your page:
• Example
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
obj.employees[1].firstName + " " + obj.employees[1].lastName;
</script>
infobizzs.com
13. JSON Http Request
• A common use of JSON is to read data from a web server, and display the data in a web page.
• This chapter will teach you, in 4 easy steps, how to read JSON data, using XMLHttp.
• This example reads a menu from myTutorials.txt, and displays the menu in a web page:
<div id="id01"></div>
<script>
var xmlhttp = new XMLHttpRequest();
var url = "myTutorials.txt";
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var myArr = JSON.parse(xmlhttp.responseText);
myFunction(myArr);
}
}
infobizzs.com
14. xmlhttp.open("GET", url, true);
xmlhttp.send();
function myFunction(arr) {
var out = "";
var i;
for(i = 0; i < arr.length; i++) {
out += '<a href="' + arr[i].url + '">' +
arr[i].display + '</a><br>';
}
document.getElementById("id01").innerHTML = out;
}
</script>
infobizzs.com
16. Example Explained
1: Create an array of objects.
• Use an array literal to declare an array of objects.
• Give each object two properties: display and url.
• Name the array myArray:
myArray
var myArray = [
{
"display": "JavaScriptTutorial",
"url": "http://www.w3schools.com/js/default.asp"
},
{
"display": "HTMLTutorial",
"url": "http://www.w3schools.com/html/default.asp"
},
{
"display": "CSSTutorial",
"url": "http://www.w3schools.com/css/default.asp"
}
]
infobizzs.com
17. 2: Create a JavaScript function to display the array.
• Create a function myFunction() that loops the array objects, and display the
content as HTML links:
myFunction()
function myFunction(arr) {
var out = "";
var i;
for(i = 0; i < arr.length; i++) {
out += '<a href="' + arr[i].url + '">' + arr[i].display + '</a><br>';
}
document.getElementById("id01").innerHTML = out;
}
infobizzs.com
18. 3: Create a text file
• Put the array literal in a file named myTutorials.txt:
myTutorials.txt
[
{
"display": "JavaScriptTutorial",
"url": "http://www.w3schools.com/js/default.asp"
},
{
"display": "HTMLTutorial",
"url": "http://www.w3schools.com/html/default.asp"
},
{
"display": "CSSTutorial",
"url": "http://www.w3schools.com/css/default.asp"
}
]
infobizzs.com
19. 4: Read the text file with an XMLHttpRequest
• Write an XMLHttpRequest to read the text file, and use myFunction() to display
the array:
var xmlhttp = new XMLHttpRequest();
var url = "myTutorials.txt";
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var myArr = JSON.parse(xmlhttp.responseText);
myFunction(myArr);
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
infobizzs.com