document

Python MongoDB Insert Document

A document in MongoDB is the same as a record in SQL databases. Insert Into Collection To insert a record, or document as it is called in MongoDB, into a collection, we use the insert_one() method. The first parameter of…

Python Syntax

Execute Python Syntax As we learned in the previous page, Python syntax can be executed by writing directly in the Command Line: >>> print(“Hello, World!”) Hello, World! Or by creating a python file on the server, using the .py file…

Javascript JSON.parse()

A common use of JSON is to exchange data to/from a web server. When receiving data from a web server, the data is always a string. Parse the data with JSON.parse(), and the data becomes a JavaScript object. Example –…

JSON vs XML

Both JSON and XML can be used to receive data from a web server. The following JSON and XML examples both define an employees object, with an array of 3 employees: JSON Example {“employees”:[   { “firstName”:”John”, “lastName”:”Doe” },   { “firstName”:”Anna”,…

Javascript AJAX PHP Example

AJAX is used to create more interactive applications. Example In the example , when a user types a character in the input field, a function called showHint() is executed. The function is triggered by the onkeyup event. Here is the…

Javascript AJAX – Server Response

Server Response Properties Property Description responseText get the response data as a string responseXML get the response data as XML data The responseText Property The responseText property returns the server response as a JavaScript string, and you can use it…

Javascript Web Geolocation API

Locate the User’s Position The HTML Geolocation API is used to get the geographical position of a user. Since this can compromise privacy, the position is not available unless the user approves it. Note Geolocation is most accurate for devices…

Javascript Web Workers API

A web worker is a JavaScript running in the background, without affecting the performance of the page. What is a Web Worker? When executing scripts in an HTML page, the page becomes unresponsive until the script is finished. A web…