abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

4/06/2018

Advanced Session on JSON how object declare in javascript




Connect Laptop To Computer and laptop To TV Connectivity.









hi every one today i am going to start session 7 .
let us know some short review on JSON

what is JSON.

JSON: JavaScript Object Notation.
JSON -- > a syntax for storing and exchanging data.
JSON ---> text, written with JavaScript object notation.

var abc = '{ "age":26, "city :PUNE",''name:siddhanam" }';
var anobj = JSON.parse(myJSON);
document.getElementById("abc").innerHTML = myObj.name;

<h2>Convert a string written in JSON format, into a JavaScript object.</h2>
<p id="abc"></p>

if you look at above example you can see declaration of object to variable in short declare, store , transfer in DOM this are main working of JSON.
 above example uses json parse method,
what is json parse???
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. 

in above figure shows how json parse  working.

now let us see JSON with php

<!DOCTYPE html>
<html>
<body>

<h2>Example of JSON.</h2>

<p id="abc"></p>

<script>

var xmlhttp = new XMLHttpRequest();

xmlhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        var myObj = JSON.parse(this.responseText);
        document.getElementById("demo").innerHTML = myObj[2];
    }
};
xmlhttp.open("GET", "trial.php", true);
xmlhttp.send();

</script>

</body>
</html>

in above code there is getting result of trial.php file and assign value to demo div.
suppose you type an address in trial.php or anything data by using this xmlhttp request & get method browser will show result.

json is not need any external installation .
our aim is to gain & share more & more knowledge.
you can comment if any improvement wants or if you want discuss any specific topic.
please share with your friends & all . thanks for viewing this blog. will see more detail in next session.



Session 6 HTML & CSS & JAVASCRIPT CONNECTION




Connect Laptop To Computer and laptop To TV Connectivity.









hi every one today i am going to start session 6 .
let us know more example of html with css

LET US see how to define & effect of css on html

<html>
<style>
.body
{
width:100;
padding:0;
margin:0;
}
.abc
{
width:100%;
color:red;
background:#eaeaea;
}
<style>
<body>
<div class="abc">hello this is an example</div>
<br/>
<span>here text sample</span>
<h2>Welocome Here</h2>

</body>
</html>

in the above exmple declare css that define style for div in which apply background color & color to div . text is looking in red color.

now write this code in any editor & save as html or htm extension.

and open this file in browser you see output.


now let us see another exmple.

<html>
<style>
.body
{
width:100;
padding:0;
margin:0;
}
#abc
{
width:100%;
color:red;
background:#eaeaea;
}
.xy
{
font-size:18px;
font-weight:bold;
box-shadow:1px 1px 1px rgba(0,0,0,0.2);
}

<style>
<body>
<div id="abc">hello this is an example</div>
<br/>
<p>hello this is just example</p>
<span>here text sample</span>
<h2>Welocome Here</h2>
<div class="xy">hi here you can learn web programing</div>
</body>
</html>


<!doctype html>
<html>
<head>
<script>
function adding(){
var a,b,c;
a=Number(document.getElementById("firstinput").value);
b=Number(document.getElementById("secondinput").value);
c= a + b;
document.getElementById("result").value= c;
}
</script>
</head>
<body>
<input id="firstinput">
<input id="secondinput">
<button onclick="add()">Add</button>
<input id="result">
</body>
</html>

please share with your friends & all . thanks for viewing this blog. will see more detail in next session.

An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...