SlideServe
Menu
Préférences
© SlideServe · v2026

Ajax

milla avatar
7 diapositives · 230 Views · Aug 05, 2014

Ajax. Section led by Ivan Lee. Reachable at ivan period lee at cs period stanford period edu. Basic AJAX Flow. User types a character Javascript invoked (hint: use a JS class) Create and set a function that will be called when an HTTP status 200 is returned

Ajax - slide 1
01 / 7Ajax
1 / 17

Télécharger la présentation

Ajax
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Ajax Section led by Ivan Lee Reachable at ivan period lee at cs period stanford period edu

  2. Basic AJAX Flow • User types a character • Javascript invoked (hint: use a JS class) • Create and set a function that will be called when an HTTP status 200 is returned • Construct a POST url to a specific method of a Rails controller, incorporating any necessary parameters • Send the xmlhttp request

  3. Basic AJAX Flow (part 2) • Rails method invoked • Perform any database queries that need to be done server-side • Render a partial – this creates full HTML, which is treated as the xmlhttp response! • What happens if you return a JSON object instead? • Set the innerhtml of the appropriate object

  4. XMLHTTP • if (window.XMLHttpRequest) { this.xmlhttp = new XMLHttpRequest(); } • this.xmlhttp.onreadystatechange = function()… • this.xmlhttp.open(sMethod, sUrl) • this.xmlhttp.setRequestHeader(sName, sValue) • this.xmlhttp.send(varBody) • this.xmlhttp.responseText

  5. Reminders • Make sure you think about how to make your classes and AJAX code reusable • Make sure you pass along an authenticity token! (see assignment hints section) • Encode your parameters (see assignment hints section) • Make sure thumbnails redirect to the appropriate link. If the user has a large photo collection, make sure that the selected photo is visible. • No using any other JS frameworks, or built-in Rails Ajax Helpers • Test in Firefox • Validate your HTML

  6. Reminders (part 2) • This is the last project!If you want to strut your stuff, this is the time to do it. You have all these tools at your disposal.

  7. <Questions…? />