Jquery ajax
This presentation is the property of its rightful owner.
Sponsored Links
1 / 7

jQuery AJAX PowerPoint PPT Presentation


  • 104 Views
  • Uploaded on
  • Presentation posted in: General

jQuery AJAX. AJAX. AJAX = Asynchronous JavaScript and XML Loading data in the background Display on the Web page w/o reloading jQuery simplifies writing AJAX code. jQuery load(). Simple and powerful AJAX method Puts the returned data into the selected element

Download Presentation

jQuery AJAX

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Jquery ajax

jQuery AJAX


Jquery ajax

AJAX

  • AJAX = Asynchronous JavaScript and XML

    • Loading data in the background

    • Display on the Web page w/o reloading

  • jQuery simplifies writing AJAX code


Jquery load

jQuery load()

  • Simple and powerful AJAX method

  • Puts the returned data into the selected element

    • $(selector).load(URL,data,callback);

      • URL, required, the URL to load

        • Can add selector to end of URL

      • data, optional, key-value pairs to send

      • callback, optional, function to run when complete

        • function(responseTxt,statusTxt,xhr) {…}


Jquery load1

jQuery load()

  • Callback function

    • function(response,status,xhr)

      • response contains the result data from request

      • status contains the status of the request

        • “success”, “notmodified”, “error”, “timeout”, “parsererror”

      • xhr contains the XMLHttpRequest object


Jquery get

jQuery get()

  • Creates an HTTP GET request

    • $.get(URL,data,callback,dataType)

      • URL, required

      • data, optional, key-value pairs sent to server

      • callback, optional

        • function(data,status,xhr)

      • dataType, optional, the data type expected of the server response

        • “xml”, “html”, “text”, “script”, “json”


Jquery post

jQuery post()

  • Creates an HTTP POST request

    • $.post(URL,data,callback,dataType)

      • URL, required

      • data, optional, data to send to server

      • callback, optional

        • function(data,status,xhr)

      • dataType, optional, the data type of the expected server response


Jquery ajax1

jQueryajax()

  • Generic AJAX HTTP request

    • $.ajax({name:value,name:value,…})

      • url: specifies the URL

      • type: specifies the type of HTTP request

      • content: specifies “this” for callback functions

      • success:function(result,status,xhr) runs if request is successful

      • error:function(result,status,xhr) runs if there is an error

      • complete:function(xhr,status) runs after request is finished (success and error)


  • Login