SlideShare a Scribd company logo
IMROKRAFT
Crafting the future
Ph.no:(0471)6555744
Site: http://www.imrokraft.com/
Akhil Krishnan R S
Arun Solomon
Imrokraft Solution
INTRODUCTION
• AJAX(Asynchronous JavaScript and XML)
• It is used to create asynchronous Web application
for creating fast and dynamic web pages
• Without reloading a webpage the contents are
automatically generated.
• JSON(JavaScript Object Notation) is often used in
Ajax.
• Both HTML and CSS combined to markup and style
information.
WORKING PRINCIPLE
ASYNCHRONOUS WEB APPLICATION
MODEL
• An asynchronous request doesn’t block the
server, so it can run another request by
background
AJAX TECHNOLOGY
• Ajax is not a technology but it is grop of inter-related
technology
• HTML/XHTML and CSS
• These technologies are used for displaying content and style.
It is mainly used for presentation.
• DOM
• It is used for dynamic display and interaction with data.
• XML or JSON
• For carrying data to and from server.
• XMLHttpRequest
• For asynchronous communication between client and server
• JavaScript
• It is used to bring above technologies together. And also for
client side validation
Ajax XMLHttp Request
• The keystone of AJAX is the XMLHttpRequest object.
• Syntax:- variable = new XMLHttpRequest();
Eg:
var xhttp;
if (window.XMLHttpRequest) {
xhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xhttp = new
ActiveXObject("Microsoft.XMLHTTP");
}
EVENTS
Property Description
onreadystatechange
Stores a function (or the name of a
function) to be called automatically each
time the readyState property changes
readyState
Holds the status of the XMLHttpRequest.
Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
status
200: "OK"
404: Page not found
• The common properties of XMLHttpRequest
object are as follows:
CONT..
Method Description
void open(method, URL)
opens the request specifying get or post
method and url.
void open(method, URL, async)
same as above but specifies asynchronous
or not.
void open(method, URL, async, username,
password)
same as above but specifies username
and password.
void send() sends get request.
void send(string) send post request.
setRequestHeader(header,value) it adds request headers.
• The important methods of XMLHttpRequest object
are as follows:
AJAX AND FORMS
• Ajax capable for deal with forms.
• Which helps to provide serialization, using two
methods .serialize() and .serializeArray().
Eg:
$(“#myForm”).serialize();
$(“#myForm”).serializeArray();
// #myForm is Form id
• To simple client side validation.
CONT..
• Using validation to check for the presence of
an input
Eg:
$( "#form" ).submit(function( event ) {
// If .required's value's length is zero
if ( $( ".required" ).val().length === 0 ) {
// Usually show some kind of error message here
// Prevent the form from submitting
event.preventDefault();
} else {
// Run $.ajax() here
}
});
CONT..
• Prefiltering is a way to modify the ajax options before
each request is sent.
Eg:
// Using a proxy with a prefilter
$.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
if ( options.crossDomain ) {
options.url = "http://mydomain.net/proxy/" +
encodeURIComponent( options.url );
options.crossDomain = false;
}
});
AJAX EXAMPLE WITH DATABASE
Steps to create ajax example with database
through jsp
• load the org.json.jar file
• create input page to receive any text or
number
• create server side page to process the request
AJAX SECURITY
• AJAX Security: Server Side
• Ajax implements declarative and programmatic
security through specifying authentication,
authorization, and data protection.
• AJAX-based Web applications are subject to the
same security threats as regular Web applications.
CONT..
AJAX Security: Client Side
• JavaScript code is visible to a user/hackers, so
they can easly inferring server-side weaknesses.
• JavaScript code is downloaded from the server
and executed ("eval") at the client and can
compromise the client by mal-intended code.
• Downloaded JavaScript code is constrained by the
sand-box security model and can be relaxed for
signed JavaScript.
AJAX USED IN
• Google maps
• Google suggest
• Gmail
• Yahoo maps
• Facebook
• Twitter etc
Understanding Javascript AJAX - Imrokraft

More Related Content

PDF
Spca2014 js link and display templates hatch
NCCOMMS
 
PPTX
2010 - Developer look at the Client Object Model
Chris O'Connor
 
PDF
[2015/2016] Require JS and Handlebars JS
Ivano Malavolta
 
PDF
[2015/2016] JavaScript
Ivano Malavolta
 
PPTX
Javascript validating form
Jesus Obenita Jr.
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
PDF
Client side scripting
Eleonora Ciceri
 
DOCX
Validation using javascripts by karan chanana
karan info
 
Spca2014 js link and display templates hatch
NCCOMMS
 
2010 - Developer look at the Client Object Model
Chris O'Connor
 
[2015/2016] Require JS and Handlebars JS
Ivano Malavolta
 
[2015/2016] JavaScript
Ivano Malavolta
 
Javascript validating form
Jesus Obenita Jr.
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Client side scripting
Eleonora Ciceri
 
Validation using javascripts by karan chanana
karan info
 

What's hot (20)

PPTX
Javascript
Sun Technlogies
 
PDF
JavaScript - Chapter 3 - Introduction
WebStackAcademy
 
PDF
Java script tutorial
Doeun KOCH
 
PPTX
Complete Notes on Angular 2 and TypeScript
EPAM Systems
 
PPTX
Wix Machine Learning - Ran Romano
Wix Engineering
 
PPTX
Javascript for the c# developer
Salvatore Fazio
 
PPTX
Refs in react
NodeXperts
 
PDF
JavaScript
Ivano Malavolta
 
PPT
Java Script ppt
Priya Goyal
 
PPT
Scripting languages
teach4uin
 
ODP
jTransfo quickie at JavaZone 2015
Joachim Van der Auwera
 
PPTX
Client side scripting using Javascript
Bansari Shah
 
PPTX
Jquery fundamentals
Salvatore Fazio
 
PPT
Learn javascript easy steps
prince Loffar
 
PPT
Angularjs for kolkata drupal meetup
Goutam Dey
 
PPT
Web development basics (Part-1)
Rajat Pratap Singh
 
PDF
Advanced O/R Mapping with Glorp
ESUG
 
PPT
Ajax Fundamentals Web Applications
dominion
 
PPTX
Introduction to JavaScript
Marlon Jamera
 
Javascript
Sun Technlogies
 
JavaScript - Chapter 3 - Introduction
WebStackAcademy
 
Java script tutorial
Doeun KOCH
 
Complete Notes on Angular 2 and TypeScript
EPAM Systems
 
Wix Machine Learning - Ran Romano
Wix Engineering
 
Javascript for the c# developer
Salvatore Fazio
 
Refs in react
NodeXperts
 
JavaScript
Ivano Malavolta
 
Java Script ppt
Priya Goyal
 
Scripting languages
teach4uin
 
jTransfo quickie at JavaZone 2015
Joachim Van der Auwera
 
Client side scripting using Javascript
Bansari Shah
 
Jquery fundamentals
Salvatore Fazio
 
Learn javascript easy steps
prince Loffar
 
Angularjs for kolkata drupal meetup
Goutam Dey
 
Web development basics (Part-1)
Rajat Pratap Singh
 
Advanced O/R Mapping with Glorp
ESUG
 
Ajax Fundamentals Web Applications
dominion
 
Introduction to JavaScript
Marlon Jamera
 
Ad

Viewers also liked (10)

PDF
Triumph2
Chandar Pokala
 
PDF
Javascript ajax tutorial
Vlad Posea
 
PPT
JavaScript JQUERY AJAX
Makarand Bhatambarekar
 
PDF
Javascript & Ajax Basics
Richard Paul
 
PPT
An Introduction to Ajax Programming
hchen1
 
PPT
Ajax Ppt
Hema Prasanth
 
PDF
Introduction to ajax
Nir Elbaz
 
PPTX
JSON: The Basics
Jeff Fox
 
PPTX
Ajax ppt - 32 slides
Smithss25
 
PPTX
Introduction to ajax
Raja V
 
Triumph2
Chandar Pokala
 
Javascript ajax tutorial
Vlad Posea
 
JavaScript JQUERY AJAX
Makarand Bhatambarekar
 
Javascript & Ajax Basics
Richard Paul
 
An Introduction to Ajax Programming
hchen1
 
Ajax Ppt
Hema Prasanth
 
Introduction to ajax
Nir Elbaz
 
JSON: The Basics
Jeff Fox
 
Ajax ppt - 32 slides
Smithss25
 
Introduction to ajax
Raja V
 
Ad

Similar to Understanding Javascript AJAX - Imrokraft (20)

PPT
Ajax tutorial by bally chohan
WebVineet
 
PPT
AJAX
ankurgupta
 
PPS
Sohamsg ajax
Soham Sengupta
 
PPTX
AJAX.pptx
Ganesh Chavan
 
DOCX
Copy of ajax tutorial
Abhishek Kesharwani
 
PPTX
Unit-5.pptx
itzkuu01
 
PPT
Asynchronous JavaScript & XML (AJAX)
Adnan Sohail
 
PPT
AJAX.ppt
karan419841
 
PPT
Ajax
Manav Prasad
 
PPT
Ajax
TSUBHASHRI
 
PPT
Ajax
Siya Agarwal
 
PPTX
Learn AJAX at ASIT
ASIT
 
PPT
Ajax
sujaykumar
 
PPT
Ajax Overview by Bally Chohan
WebVineet
 
Ajax tutorial by bally chohan
WebVineet
 
Sohamsg ajax
Soham Sengupta
 
AJAX.pptx
Ganesh Chavan
 
Copy of ajax tutorial
Abhishek Kesharwani
 
Unit-5.pptx
itzkuu01
 
Asynchronous JavaScript & XML (AJAX)
Adnan Sohail
 
AJAX.ppt
karan419841
 
Learn AJAX at ASIT
ASIT
 
Ajax Overview by Bally Chohan
WebVineet
 

More from imrokraft (6)

PPT
Php intership in trivandrum - IMROKRAFT Solutions
imrokraft
 
PPTX
Android training in technopark - Imrokraft
imrokraft
 
PPTX
CSS3 basics for beginners - Imrokraft
imrokraft
 
PPTX
CSS3 Animation for beginners - Imrokraft
imrokraft
 
PPTX
HTML5 tutorials for beginners - Imrokraft
imrokraft
 
PPTX
Understanding JSON using Java - Imrokraft
imrokraft
 
Php intership in trivandrum - IMROKRAFT Solutions
imrokraft
 
Android training in technopark - Imrokraft
imrokraft
 
CSS3 basics for beginners - Imrokraft
imrokraft
 
CSS3 Animation for beginners - Imrokraft
imrokraft
 
HTML5 tutorials for beginners - Imrokraft
imrokraft
 
Understanding JSON using Java - Imrokraft
imrokraft
 

Recently uploaded (20)

PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
PDF
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
PDF
Wings of Fire Book by Dr. A.P.J Abdul Kalam Full PDF
hetalvaishnav93
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
Wings of Fire Book by Dr. A.P.J Abdul Kalam Full PDF
hetalvaishnav93
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
TEF & EA Bsc Nursing 5th sem.....BBBpptx
AneetaSharma15
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 

Understanding Javascript AJAX - Imrokraft

  • 1. IMROKRAFT Crafting the future Ph.no:(0471)6555744 Site: http://www.imrokraft.com/ Akhil Krishnan R S Arun Solomon Imrokraft Solution
  • 2. INTRODUCTION • AJAX(Asynchronous JavaScript and XML) • It is used to create asynchronous Web application for creating fast and dynamic web pages • Without reloading a webpage the contents are automatically generated. • JSON(JavaScript Object Notation) is often used in Ajax. • Both HTML and CSS combined to markup and style information.
  • 4. ASYNCHRONOUS WEB APPLICATION MODEL • An asynchronous request doesn’t block the server, so it can run another request by background
  • 5. AJAX TECHNOLOGY • Ajax is not a technology but it is grop of inter-related technology • HTML/XHTML and CSS • These technologies are used for displaying content and style. It is mainly used for presentation. • DOM • It is used for dynamic display and interaction with data. • XML or JSON • For carrying data to and from server. • XMLHttpRequest • For asynchronous communication between client and server • JavaScript • It is used to bring above technologies together. And also for client side validation
  • 6. Ajax XMLHttp Request • The keystone of AJAX is the XMLHttpRequest object. • Syntax:- variable = new XMLHttpRequest(); Eg: var xhttp; if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  • 7. EVENTS Property Description onreadystatechange Stores a function (or the name of a function) to be called automatically each time the readyState property changes readyState Holds the status of the XMLHttpRequest. Changes from 0 to 4: 0: request not initialized 1: server connection established 2: request received 3: processing request 4: request finished and response is ready status 200: "OK" 404: Page not found • The common properties of XMLHttpRequest object are as follows:
  • 8. CONT.. Method Description void open(method, URL) opens the request specifying get or post method and url. void open(method, URL, async) same as above but specifies asynchronous or not. void open(method, URL, async, username, password) same as above but specifies username and password. void send() sends get request. void send(string) send post request. setRequestHeader(header,value) it adds request headers. • The important methods of XMLHttpRequest object are as follows:
  • 9. AJAX AND FORMS • Ajax capable for deal with forms. • Which helps to provide serialization, using two methods .serialize() and .serializeArray(). Eg: $(“#myForm”).serialize(); $(“#myForm”).serializeArray(); // #myForm is Form id • To simple client side validation.
  • 10. CONT.. • Using validation to check for the presence of an input Eg: $( "#form" ).submit(function( event ) { // If .required's value's length is zero if ( $( ".required" ).val().length === 0 ) { // Usually show some kind of error message here // Prevent the form from submitting event.preventDefault(); } else { // Run $.ajax() here } });
  • 11. CONT.. • Prefiltering is a way to modify the ajax options before each request is sent. Eg: // Using a proxy with a prefilter $.ajaxPrefilter(function( options, originalOptions, jqXHR ) { if ( options.crossDomain ) { options.url = "http://mydomain.net/proxy/" + encodeURIComponent( options.url ); options.crossDomain = false; } });
  • 12. AJAX EXAMPLE WITH DATABASE Steps to create ajax example with database through jsp • load the org.json.jar file • create input page to receive any text or number • create server side page to process the request
  • 13. AJAX SECURITY • AJAX Security: Server Side • Ajax implements declarative and programmatic security through specifying authentication, authorization, and data protection. • AJAX-based Web applications are subject to the same security threats as regular Web applications.
  • 14. CONT.. AJAX Security: Client Side • JavaScript code is visible to a user/hackers, so they can easly inferring server-side weaknesses. • JavaScript code is downloaded from the server and executed ("eval") at the client and can compromise the client by mal-intended code. • Downloaded JavaScript code is constrained by the sand-box security model and can be relaxed for signed JavaScript.
  • 15. AJAX USED IN • Google maps • Google suggest • Gmail • Yahoo maps • Facebook • Twitter etc