SlideShare ist ein Scribd-Unternehmen logo
1 von 33
AJAX Building faster dynamic websites - Asynchronous JavaScript and XML
Ajax Ajax is a  group  of web development methods used on the client-side to create interactive web applications. With Ajax, web applications can send data  to , and retrieve data  from , a server  asynchronously  (in the background) without interfering with the display and behavior of the existing page. Data are usually retrieved using the  XMLHttpRequest  object.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Advantages ,[object Object],[object Object],[object Object],[object Object],[object Object]
Disadvantages ,[object Object],[object Object],[object Object],[object Object]
Disadvantages ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
Synchronous ,[object Object],[object Object],[object Object],[object Object]
Asynchronous(99%) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Beginners fall into trap. Why? Rare situations  where it just doesn't make any sense at all  to allow your visitor to continue interacting with the web page  until a particular server side process completes. The only difference  when using asynchronous calls  is that you can actually set up multiple Ajax calls that overlap with a second call being made before the first has responded. This is where  asynchronous Ajax does become slightly more complicated  than synchronous Ajax because you need to make sure that  each Ajax request uses a separate Ajax object  rather than reusing the same object for all your Ajax requests
Two choices of passing the request ,[object Object],[object Object],[object Object],[object Object]
Passing request to server: Differences ,[object Object],[object Object],[object Object]
How to choose between GET & POST? ,[object Object],[object Object],[object Object]
How to choose between GET & POST? ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ajax jQuery syntax jQuery.ajax( url, [settings] )  Or jQuery.ajax( settings ) Url : A string containing the URL to which the  request is sent . Settings : A set of key/value pairs that  configure the Ajax request . All settings are  optional . A default can be set for any option with  $.ajaxSetup() .
Settings Accepts ( Map -depends on Datatype):  The content type sent in the request header that  tells the server what kind of response it will accept  in return. Async(Boolean-true):  By default, all requests are  sent asynchronously . If you need synchronous requests, set this option to false. Synchronous requests may  temporarily lock the browser . BeforeSend(jqXHR, settings)- Function A  pre-request callback function  that can be used to modify the  jqXHR object  before it is sent. Used to set custom headers, etc.
Settings Cache(Boolean-true, false for DataType 'script' and 'jsonp'):  If set to false, it will  force requested pages not to be cached by the browser . Setting cache to false also  appends a query string parameter, "_=[TIMESTAMP]" , to the URL. Complete(jqXHR, textStatus)-Function,Array A function to be called when the  request finishes . Two arguments: The  jqXHR object  and a string categorizing the  status of the request  ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). Contents(1.5) A map of string/regular-expression pairs that  determine how jQuery will parse the response , given its content type.
Settings ContentType(String-'application/x-www-form-urlencoded‘) When sending data to the server,  uses this content-type . Context(Object) This object will be made the context of all Ajax-related callbacks. Converters(Map) A map of  dataType-to-dataType converters . Each converter's value is a function that returns the transformed value of the response.
Settings CrossDomain(Boolean-false for same-domain requests, true for cross-domain requests) Set the value of crossDomain to true for,  server-side redirection to another domain . Data(Object) Data to be  sent to the server . It is converted to a  query string , if not already a string. It's appended to the url for GET-requests.  Key-value pairs . DataType(String-Intelligent Guess-xml, json, script, or html) The type of data that you're  expecting back from the server .
Settings Error(jqXHR, textStatus, errorThrown)- Function A function to be called if the  request fails . TextStatus-"timeout", "error", "abort", and "parsererror“ and ErrorThrown- for HTTP errors. "Not Found" or "Internal Server Error.“ Global(Boolean-true) Whether to  trigger global Ajax event handlers  for this request. Set to false to  prevent the global handlers  like ajaxStart or ajaxStop from being triggered. Headers(1.5) A map of  additional header key/value pairs  to send along with the request. This setting is set  before the beforeSend  function is called; therefore, any values in the headers setting can be  overwritten  from within the beforeSend function.
Settings IfModified(Boolean-false) Allow the  request to be successful only if the response has changed  since the last request. IsLocal(1.5) Allow the  current environment to be recognized as "local"  (e.g. the filesystem) Jsonp(String) Override the callback function  name in a jsonp request.
Settings JsonpCallback(String) Specify the  callback function name  for a JSONP request. MimeType(1.5) A mime type to  override the XHR  mime type. Password(String) and Username(String A password to be used in response to an  HTTP access authentication  request. ProcessData(Boolean-true) By default data is processed as QueryString. Any DOMDocument or non-processed data set it to false.
Settings ScriptCharset(String)   Only for requests with  "jsonp" or "script"  dataType and  "GET"  type. Forces the request to be  interpreted as a certain charset . StatusCode(1.5)   A map of numeric  HTTP codes and functions  to be called when the response has the corresponding code. Success(data, textStatus, jqXHR)   A function to be called if the  request succeeds . Timeout(Number)   Set a local timeout (in milliseconds) for the request.
Settings Type(String-GET)   The  type of request  to make ("POST" or "GET"). Url(String- The current page)   A string containing the URL  to which the request is sent . Xhr(Function-ActiveXObject)   Callback  for creating the XMLHttpRequest object. XhrFields(Map)   A map of fieldName-fieldValue pairs to set on the  native XHR object . Ex: Set  withCredentials  to true for  cross-domain requests  if needed
The jqXHR Object ,[object Object],[object Object],[object Object],[object Object],[object Object]
AJAX on Hands
Global Ajax Event Handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Global Ajax Event Handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Helper Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Low-Level Interface ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Shorthand Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Shorthand Methods ,[object Object],[object Object],[object Object],[object Object]
No Queries? THANK YOU

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScriptT11 Sessions
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)WebStackAcademy
 
What is Ajax technology?
What is Ajax technology?What is Ajax technology?
What is Ajax technology?JavaTpoint.Com
 
Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overviewJacob Nelson
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginnersSingsys Pte Ltd
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScriptShahDhruv21
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajaxPihu Goel
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryFAKHRUN NISHA
 
Introduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptIntroduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptMuhammadRehan856177
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentationengcs2008
 
JavaScript - Chapter 14 - Form Handling
 JavaScript - Chapter 14 - Form Handling   JavaScript - Chapter 14 - Form Handling
JavaScript - Chapter 14 - Form Handling WebStackAcademy
 

Was ist angesagt? (20)

Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
What is Ajax technology?
What is Ajax technology?What is Ajax technology?
What is Ajax technology?
 
Html5 and-css3-overview
Html5 and-css3-overviewHtml5 and-css3-overview
Html5 and-css3-overview
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
JavaScript: Events Handling
JavaScript: Events HandlingJavaScript: Events Handling
JavaScript: Events Handling
 
HTML/CSS/java Script/Jquery
HTML/CSS/java Script/JqueryHTML/CSS/java Script/Jquery
HTML/CSS/java Script/Jquery
 
Introduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptIntroduction to JavaScript (1).ppt
Introduction to JavaScript (1).ppt
 
Javascript
JavascriptJavascript
Javascript
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
JavaScript - Chapter 14 - Form Handling
 JavaScript - Chapter 14 - Form Handling   JavaScript - Chapter 14 - Form Handling
JavaScript - Chapter 14 - Form Handling
 
jQuery
jQueryjQuery
jQuery
 
Web api
Web apiWeb api
Web api
 
Java script
Java scriptJava script
Java script
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 

Andere mochten auch

CSS Fundamentals: selectors and Properties
CSS Fundamentals: selectors and PropertiesCSS Fundamentals: selectors and Properties
CSS Fundamentals: selectors and PropertiesPedro Valente
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignZoe Gillenwater
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media QueriesRuss Weakley
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajaxNir Elbaz
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to BootstrapRon Reiter
 

Andere mochten auch (8)

Jquery Ajax
Jquery AjaxJquery Ajax
Jquery Ajax
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
 
CSS Fundamentals: selectors and Properties
CSS Fundamentals: selectors and PropertiesCSS Fundamentals: selectors and Properties
CSS Fundamentals: selectors and Properties
 
Ajax and Jquery
Ajax and JqueryAjax and Jquery
Ajax and Jquery
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Introduction to Bootstrap
Introduction to BootstrapIntroduction to Bootstrap
Introduction to Bootstrap
 

Ähnlich wie jQuery Ajax (20)

Mashup
MashupMashup
Mashup
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
Ajax Basics And Framework
Ajax Basics And FrameworkAjax Basics And Framework
Ajax Basics And Framework
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Ajax
AjaxAjax
Ajax
 
Ajax and PHP
Ajax and PHPAjax and PHP
Ajax and PHP
 
AJAX
AJAXAJAX
AJAX
 
25250716 seminar-on-ajax text
25250716 seminar-on-ajax text25250716 seminar-on-ajax text
25250716 seminar-on-ajax text
 
Ajax
AjaxAjax
Ajax
 
M Ramya
M RamyaM Ramya
M Ramya
 
Ajax Ppt 1
Ajax Ppt 1Ajax Ppt 1
Ajax Ppt 1
 
Overview of AJAX
Overview of AJAXOverview of AJAX
Overview of AJAX
 
Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 

Mehr von Anand Kumar Rajana (12)

Interface Vs Abstact
Interface Vs AbstactInterface Vs Abstact
Interface Vs Abstact
 
Anand's Leadership Assessment
Anand's Leadership AssessmentAnand's Leadership Assessment
Anand's Leadership Assessment
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
Rhino Mocks
Rhino MocksRhino Mocks
Rhino Mocks
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
The Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.NetThe Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.Net
 
What Do You Mean By NUnit
What Do You Mean By NUnitWhat Do You Mean By NUnit
What Do You Mean By NUnit
 
Wcf
WcfWcf
Wcf
 
Sql Server 2012 Installation..
Sql Server 2012 Installation..Sql Server 2012 Installation..
Sql Server 2012 Installation..
 
Json
JsonJson
Json
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
J Query Introduction And JQuery Selectors
J Query Introduction And JQuery SelectorsJ Query Introduction And JQuery Selectors
J Query Introduction And JQuery Selectors
 

Kürzlich hochgeladen

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

jQuery Ajax

  • 1. AJAX Building faster dynamic websites - Asynchronous JavaScript and XML
  • 2. Ajax Ajax is a group of web development methods used on the client-side to create interactive web applications. With Ajax, web applications can send data to , and retrieve data from , a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data are usually retrieved using the XMLHttpRequest object.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Beginners fall into trap. Why? Rare situations where it just doesn't make any sense at all to allow your visitor to continue interacting with the web page until a particular server side process completes. The only difference when using asynchronous calls is that you can actually set up multiple Ajax calls that overlap with a second call being made before the first has responded. This is where asynchronous Ajax does become slightly more complicated than synchronous Ajax because you need to make sure that each Ajax request uses a separate Ajax object rather than reusing the same object for all your Ajax requests
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Ajax jQuery syntax jQuery.ajax( url, [settings] ) Or jQuery.ajax( settings ) Url : A string containing the URL to which the request is sent . Settings : A set of key/value pairs that configure the Ajax request . All settings are optional . A default can be set for any option with $.ajaxSetup() .
  • 16. Settings Accepts ( Map -depends on Datatype): The content type sent in the request header that tells the server what kind of response it will accept in return. Async(Boolean-true): By default, all requests are sent asynchronously . If you need synchronous requests, set this option to false. Synchronous requests may temporarily lock the browser . BeforeSend(jqXHR, settings)- Function A pre-request callback function that can be used to modify the jqXHR object before it is sent. Used to set custom headers, etc.
  • 17. Settings Cache(Boolean-true, false for DataType 'script' and 'jsonp'): If set to false, it will force requested pages not to be cached by the browser . Setting cache to false also appends a query string parameter, "_=[TIMESTAMP]" , to the URL. Complete(jqXHR, textStatus)-Function,Array A function to be called when the request finishes . Two arguments: The jqXHR object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). Contents(1.5) A map of string/regular-expression pairs that determine how jQuery will parse the response , given its content type.
  • 18. Settings ContentType(String-'application/x-www-form-urlencoded‘) When sending data to the server, uses this content-type . Context(Object) This object will be made the context of all Ajax-related callbacks. Converters(Map) A map of dataType-to-dataType converters . Each converter's value is a function that returns the transformed value of the response.
  • 19. Settings CrossDomain(Boolean-false for same-domain requests, true for cross-domain requests) Set the value of crossDomain to true for, server-side redirection to another domain . Data(Object) Data to be sent to the server . It is converted to a query string , if not already a string. It's appended to the url for GET-requests. Key-value pairs . DataType(String-Intelligent Guess-xml, json, script, or html) The type of data that you're expecting back from the server .
  • 20. Settings Error(jqXHR, textStatus, errorThrown)- Function A function to be called if the request fails . TextStatus-"timeout", "error", "abort", and "parsererror“ and ErrorThrown- for HTTP errors. "Not Found" or "Internal Server Error.“ Global(Boolean-true) Whether to trigger global Ajax event handlers for this request. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. Headers(1.5) A map of additional header key/value pairs to send along with the request. This setting is set before the beforeSend function is called; therefore, any values in the headers setting can be overwritten from within the beforeSend function.
  • 21. Settings IfModified(Boolean-false) Allow the request to be successful only if the response has changed since the last request. IsLocal(1.5) Allow the current environment to be recognized as "local" (e.g. the filesystem) Jsonp(String) Override the callback function name in a jsonp request.
  • 22. Settings JsonpCallback(String) Specify the callback function name for a JSONP request. MimeType(1.5) A mime type to override the XHR mime type. Password(String) and Username(String A password to be used in response to an HTTP access authentication request. ProcessData(Boolean-true) By default data is processed as QueryString. Any DOMDocument or non-processed data set it to false.
  • 23. Settings ScriptCharset(String) Only for requests with "jsonp" or "script" dataType and "GET" type. Forces the request to be interpreted as a certain charset . StatusCode(1.5) A map of numeric HTTP codes and functions to be called when the response has the corresponding code. Success(data, textStatus, jqXHR) A function to be called if the request succeeds . Timeout(Number) Set a local timeout (in milliseconds) for the request.
  • 24. Settings Type(String-GET) The type of request to make ("POST" or "GET"). Url(String- The current page) A string containing the URL to which the request is sent . Xhr(Function-ActiveXObject) Callback for creating the XMLHttpRequest object. XhrFields(Map) A map of fieldName-fieldValue pairs to set on the native XHR object . Ex: Set withCredentials to true for cross-domain requests if needed
  • 25.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.