What is an Array


A array is a special variable which holds multiple values.
Like if we have more that  2 times of same variety name and we want it be in a single variable we have to use array.

eg;

var fruit1="Mango"
var fruit2="Banana"
var fruit3="Orange"

Here we have  3 fruits in  different variable to merge this in a single variable we have to use an array

So an array be like
var fruits=[];

var fruits=["Mango","Banana","Orange"]
now we have all fruit items in single variable called fruit.

How to get value from the array?

So get value from the array we need index of the value like

var fruit1=fruits[0];
var fruit2=fruits[1];
var fruit3=fruits[2];

With the help of indexing we will get the value of the fruits;

How to get length of the array?

To get length of the we have to use length property

like var arraylength=fruits.length;
arraylength=3;





Concate two or more Array

 To concate or Add two or more Array value  we will use concate method.

concate return a new array consisting the values of all the array which is used to concate.

concate();


Here we have 3 arrays

var Animal=["Lion","Tiger","Leopard"]

var Fruit=["banana","mango"]

var Name=["John","Maya"]


How to concate two or more arrays?

var NewArray=Animal.concate(Fruit,Name)

now in the NewArray we will get value ="Lion","Tiger"."Leopard", "banana","mango","John","Maya"


How to use SessionStorage

 What is SessionStorage?


Basically SessionStorage is a property which is use to save value and use it accordingly from one page to other in the same Project.

It  stores data only for one session and the data get deleted when the browser closed.'


How to Store data in sessionStorage?

sessionStorage.setItem("key", "value");

Here we will set the value in key and will get it accordingly with the same key.


How to retrieve data  from sessionStorage?

var Anyvariable = sessionStorage.getItem("key");

Here in var we will get the data with that key which was used to set the value .


How to remove data  from sessionStorage?

sessionStorage.removeItem("key");

This will remove the data that is stored in the key.


How to clear  sessionStorage?

sessionStorage.clear();

It will clear all the data which is stored in session.




What is Ajax in Jquery

 Ajax Stands for AJAX = Asynchronous JavaScript and XML.


How Ajax works?

In simple words It Loads Data in background and Display in Web page.


Why Ajax?

There are Several method used in Ajax like get ,post to fetch data like HTML,XML or JSON.


Why Jquery For Ajax?

There is Something that we need to understand that there are different syntax for ajax for different browser without JQuery.With the help of Jquery we will complete ajax in sing bit of Lines.So it makes easier for developer to write less codes.



Method of Ajax

Get:-Basically Get method is used to fetch data from server 

Post:-Post method is also used to fetch data from server and also used to send parameters along with it.


Difference between Get and Post Method

Retrieved data though Get method may have cached data while in Post method it does not have Cache.


eg. For Get

    $.ajax({

        type: "Get",

        url: your URL

        cache: false,

        success: function (data) {

     $("#Data").text(data);

});

eg. For Post


  $.ajax({

        type: "Post",

        url: your URL

        success: function (data) {

     $("#Data").text(data);

});